--- Logging error ---
Traceback (most recent call last):
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/console/logging/io_handler.py", line 22, in emit
msg = self.format(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 943, in format
return fmt.format(record)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/console/logging/io_formatter.py", line 39, in format
formatted = super().format(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 678, in format
record.message = record.getMessage()
File "/usr/local/lib/python3.10/logging/__init__.py", line 368, in getMessage
msg = msg % self.args
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/py_info.py", line 270, in __str__
(
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/py_info.py", line 297, in spec
# this method is not used by itself, so here and called functions can import stuff locally
AttributeError: 'PythonInfo' object has no attribute 'free_threaded'
Call stack:
File "/usr/local/lib/python3.10/threading.py", line 973, in _bootstrap
self._bootstrap_inner()
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 83, in _worker
work_item.run()
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 274, in _execute_operation
result = self._do_execute_operation(operation)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 385, in _do_execute_operation
result: int = getattr(self, f"_execute_{method}")(operation)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 509, in _execute_install
status_code = self._install(operation)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 543, in _install
archive = self._download_link(operation, Link(package.source_url))
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/executor.py", line 714, in _download_link
archive = self._chef.prepare(archive, output_dir=original_archive.parent)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/chef.py", line 43, in prepare
return self._prepare_sdist(archive, destination=output_dir)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/chef.py", line 88, in _prepare_sdist
return self._prepare(
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/installation/chef.py", line 49, in _prepare
with isolated_builder(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/utils/isolated_build.py", line 180, in isolated_builder
with ephemeral_environment(
File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
return next(self.gen)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/utils/env/__init__.py", line 47, in ephemeral_environment
EnvManager.build_venv(
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/utils/env/env_manager.py", line 552, in build_venv
cli_result = virtualenv.cli_run(args, setup_logging=False)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 31, in cli_run
of_session = session_via_cli(args, options, setup_logging, env)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 49, in session_via_cli
parser, elements = build_parser(args, options, setup_logging, env)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/run/__init__.py", line 77, in build_parser
parser._interpreter = interpreter = discover.interpreter # noqa: SLF001
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/discover.py", line 41, in interpreter
self._interpreter = self.run()
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py", line 60, in run
result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py", line 81, in get_interpreter
LOGGER.info("proposed %s", interpreter)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1477, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1624, in _log
self.handle(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1634, in handle
self.callHandlers(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 1696, in callHandlers
hdlr.handle(record)
File "/usr/local/lib/python3.10/logging/__init__.py", line 968, in handle
self.emit(record)
File "/REDACTED_NAME/.venv/lib/python3.10/site-packages/poetry/console/logging/io_handler.py", line 30, in emit
self.handleError(record)
Message: '<fg=blue>proposed %s</>'
Arguments: (PythonInfo({'platform': 'linux', 'implementation': 'CPython', 'version_info': VersionInfo(major=3, minor=10, micro=16, releaselevel='final', serial=0), 'architecture': 64, 'version_nodot': '310', 'version': '3.10.16 (main, Jan 14 2025, 02:25:17) [GCC 12.2.0]', 'os': 'posix', 'prefix': '/usr/local', 'base_prefix': '/usr/local', 'real_prefix': None, 'base_exec_prefix': '/usr/local', 'exec_prefix': '/usr/local', 'executable': '/usr/local/bin/python3.10', 'original_executable': '/usr/local/bin/python3.10', 'system_executable': '/usr/local/bin/python3.10', 'has_venv': True, 'path': ['/REDACTED_NAME/.venv/lib/python3.10/site-packages/virtualenv/discovery', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages'], 'file_system_encoding': 'utf-8', 'stdout_encoding': 'utf-8', 'sysconfig_scheme': None, 'sysconfig_paths': {'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}', 'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}', 'purelib': '{base}/lib/python{py_version_short}/site-packages', 'platlib': '{platbase}/{platlibdir}/python{py_version_short}/site-packages', 'include': '{installed_base}/include/python{py_version_short}{abiflags}', 'scripts': '{base}/bin', 'data': '{base}'}, 'distutils_install': {'purelib': 'lib/python3.10/site-packages', 'platlib': 'lib/python3.10/site-packages', 'headers': 'include/python3.10/UNKNOWN', 'scripts': 'bin', 'data': ''}, 'sysconfig': {'makefile_filename': '/usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu/Makefile'}, 'sysconfig_vars': {'base': '/usr/local', 'abiflags': '', 'PYTHONFRAMEWORK': '', 'platlibdir': 'lib', 'platbase': '/usr/local', 'py_version_short': '3.10', 'installed_base': '/usr/local'}, 'system_stdlib': '/usr/local/lib/python3.10', 'system_stdlib_platform': '/usr/local/lib/python3.10', 'max_size': 9223372036854775807}),)
Stack trace:
19 .venv/lib/python3.10/site-packages/poetry/installation/executor.py:274 in _execute_operation
272│
273│ try:
→ 274│ result = self._do_execute_operation(operation)
275│ except EnvCommandError as e:
276│ if e.e.returncode == -2:
18 .venv/lib/python3.10/site-packages/poetry/installation/executor.py:385 in _do_execute_operation
383│ return 0
384│
→ 385│ result: int = getattr(self, f"_execute_{method}")(operation)
386│
387│ if result != 0:
17 .venv/lib/python3.10/site-packages/poetry/installation/executor.py:509 in _execute_install
507│
508│ def _execute_install(self, operation: Install | Update) -> int:
→ 509│ status_code = self._install(operation)
510│
511│ self._save_url_reference(operation)
16 .venv/lib/python3.10/site-packages/poetry/installation/executor.py:543 in _install
541│ elif package.source_type == "url":
542│ assert package.source_url is not None
→ 543│ archive = self._download_link(operation, Link(package.source_url))
544│ else:
545│ archive = self._download(operation)
15 .venv/lib/python3.10/site-packages/poetry/installation/executor.py:714 in _download_link
712│ self._write(operation, message)
713│
→ 714│ archive = self._chef.prepare(archive, output_dir=original_archive.parent)
715│
716│ # Use the original archive to provide the correct hash.
14 .venv/lib/python3.10/site-packages/poetry/installation/chef.py:43 in prepare
41│ return self._prepare(archive, destination=destination, editable=editable)
42│
→ 43│ return self._prepare_sdist(archive, destination=output_dir)
44│
45│ def _prepare(
13 .venv/lib/python3.10/site-packages/poetry/installation/chef.py:88 in _prepare_sdist
86│ destination.mkdir(parents=True, exist_ok=True)
87│
→ 88│ return self._prepare(
89│ sdist_dir,
90│ destination,
12 .venv/lib/python3.10/site-packages/poetry/installation/chef.py:49 in _prepare
47│ ) -> Path:
48│ distribution: DistributionType = "editable" if editable else "wheel"
→ 49│ with isolated_builder(
50│ source=directory,
51│ distribution=distribution,
11 /usr/local/lib/python3.10/contextlib.py:135 in __enter__
133│ del self.args, self.kwds, self.func
134│ try:
→ 135│ return next(self.gen)
136│ except StopIteration:
137│ raise RuntimeError("generator didn't yield") from None
10 .venv/lib/python3.10/site-packages/poetry/utils/isolated_build.py:180 in isolated_builder
178│ )
179│
→ 180│ with ephemeral_environment(
181│ executable=python_executable,
182│ flags={"no-pip": True},
9 /usr/local/lib/python3.10/contextlib.py:135 in __enter__
133│ del self.args, self.kwds, self.func
134│ try:
→ 135│ return next(self.gen)
136│ except StopIteration:
137│ raise RuntimeError("generator didn't yield") from None
8 .venv/lib/python3.10/site-packages/poetry/utils/env/__init__.py:47 in ephemeral_environment
45│ # TODO: cache PEP 517 build environment corresponding to each project venv
46│ venv_dir = Path(tmp_dir) / ".venv"
→ 47│ EnvManager.build_venv(
48│ path=venv_dir,
49│ executable=executable,
7 .venv/lib/python3.10/site-packages/poetry/utils/env/env_manager.py:552 in build_venv
550│ args.append(str(path))
551│
→ 552│ cli_result = virtualenv.cli_run(args, setup_logging=False)
553│
554│ # Exclude the venv folder from from macOS Time Machine backups
6 .venv/lib/python3.10/site-packages/virtualenv/run/__init__.py:31 in cli_run
29│ """
30│ env = os.environ if env is None else env
→ 31│ of_session = session_via_cli(args, options, setup_logging, env)
32│ with of_session:
33│ of_session.run()
5 .venv/lib/python3.10/site-packages/virtualenv/run/__init__.py:49 in session_via_cli
47│ """""" # noqa: D205
48│ env = os.environ if env is None else env
→ 49│ parser, elements = build_parser(args, options, setup_logging, env)
50│ options = parser.parse_args(args)
51│ creator, seeder, activators = tuple(e.create(options) for e in elements) # create types
4 .venv/lib/python3.10/site-packages/virtualenv/run/__init__.py:77 in build_parser
75│
76│ discover = get_discover(parser, args)
→ 77│ parser._interpreter = interpreter = discover.interpreter # noqa: SLF001
78│ if interpreter is None:
79│ msg = f"failed to find interpreter for {discover}"
3 .venv/lib/python3.10/site-packages/virtualenv/discovery/discover.py:41 in interpreter
39│ """:return: the interpreter as returned by :meth:`run`, cached"""
40│ if self._has_run is False:
→ 41│ self._interpreter = self.run()
42│ self._has_run = True
43│ return self._interpreter
2 .venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py:60 in run
58│ def run(self) -> PythonInfo | None:
59│ for python_spec in self.python_spec:
→ 60│ result = get_interpreter(python_spec, self.try_first_with, self.app_data, self._env)
61│ if result is not None:
62│ return result
1 .venv/lib/python3.10/site-packages/virtualenv/discovery/builtin.py:82 in get_interpreter
80│ continue
81│ LOGGER.info("proposed %s", interpreter)
→ 82│ if interpreter.satisfies(spec, impl_must_match):
83│ LOGGER.debug("accepted %s", interpreter)
84│ return interpreter
AttributeError
'PythonSpec' object has no attribute 'free_threaded'
at .venv/lib/python3.10/site-packages/virtualenv/discovery/py_info.py:335 in satisfies
331│ return False
332│ return True
333│
334│ _current_system = None
→ 335│ _current = None
336│
337│ @classmethod
338│ def current(cls, app_data=None):
339│ """
Cannot install REDACTED_PACKAGE_NAME_HERE
In order to avoid new issues being created for this error message, if you are here searching for the error message please see #10056 (comment) for resolution.
This issue was caused because of the following;
This is not a Poetry issue, but rather an issue caused by attempting to install Poetry in the same environment as it is managing. This is not recommended.
Description
I don't have a full reproducer yet, unfortunately. I have this bug in a closed-source context and haven't yet been able to recreate it.
Under the latest version of
virtualenv, a new attribute was added to thePythonInfoclass,free_threaded.In my org's usage, we're seeing an invocation of
virtualenv.cli_runwhich passes aPythonInfoobject wherefree_threadedis not defined, causing an AttributeError from withinvirtualenvitself.The conditions I have right now which cause this:
virtualenv==20.29.0setup.py, notpyproject.tomlHowever, trying to repro this in a fully open-source repo, I can't get the bug to trigger. So there may be important state I haven't captured.
Note
Without full info, this might not be possible to diagnose or resolve.
If the maintainers feel it would be best to close this as invalid, I'll continue to work on a reproducer so that I can open a fresh bug report with better detail.
I would understand that course of action and consider it reasonable if necessary, but hope that with the partial info in this report there's enough detail to find the cause.
Workarounds
poetry==1.8.5virtualenvin our build system to<20.29.0Poetry Installation Method
pip
Operating System
Debian (docker,
python3.10-slim-bookworm)Poetry Version
4.0.1
Poetry Configuration
(NB: this is a local run; in the build system we expect a different home, etc.)
Python Sysconfig
sysconfig.log
Example pyproject.toml
N/A: project is closed source and I don't have a working reproducer (yet).Poetry Runtime Logs
I've redacted some names from the tail end of the log. I can't share full output until I have an open source reproducer.
poetry-runtime.log