You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a long-time Poetry-enthusiast ❤️ Amazing project and kudos to the whole team, thanks for all you do! 🎉 🌮 🍰
Since I have a workaround, I'm not terribly worried about this issue. That said, if it helps someone else I'm happy to provide a workaround & some information.
Without `-vvv`:
$ poetry install
Configuration file exists at /Users/me/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/me/Library/Application Support/pypoetry, as support forthe legacy directory will be removedin an upcoming release.
[Errno 2] No such file or directory: 'python'
With -vvv:
myproj-py3.11brian:myproj me$ poetry install -vvv
Configuration file exists at /Users/me/Library/Preferences/pypoetry, reusing this directory.
Consider moving TOML configuration files to /Users/me/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
Loading configuration file /Users/me/Library/Preferences/pypoetry/config.toml
Loading configuration file /Users/me/Desktop/github/myjob/myproj/poetry.toml
Trying to detect current active python executable as specified in the config.
Unable to detect the current active python executable. Falling back to default.
Stack trace:
18 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/application.py:327 in run
325│
326│ try:
→ 327│ exit_code = self._run(io)
328│ except BrokenPipeError:
329│ # If we are piped to another process, it may close early and send a
17 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/console/application.py:190 in _run
188│ self._load_plugins(io)
189│
→ 190│ exit_code: int = super()._run(io)
191│ return exit_code
192│
16 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/application.py:431 in _run
429│ io.input.interactive(interactive)
430│
→ 431│ exit_code = self._run_command(command, io)
432│ self._running_command = None
433│
15 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/application.py:473 in _run_command
471│
472│ if error is not None:
→ 473│ raise error
474│
475│ return terminate_event.exit_code
14 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/application.py:454 in _run_command
452│
453│ try:
→ 454│ self._event_dispatcher.dispatch(command_event, COMMAND)
455│
456│ if command_event.command_should_run():
13 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/events/event_dispatcher.py:26 in dispatch
24│
25│ if listeners:
→ 26│ self._do_dispatch(listeners, event_name, event)
27│
28│ return event
12 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/cleo/events/event_dispatcher.py:85 in _do_dispatch
83│ break
84│
→ 85│ listener(event, event_name, self)
86│
87│ def _sort_listeners(self, event_name: str) -> None:
11 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/console/application.py:299 in configure_env
297│
298│ env_manager = EnvManager(poetry, io=io)
→ 299│ env = env_manager.create_venv()
300│
301│ if env.is_venv() and io.is_verbose():
10 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/env_manager.py:443 in create_venv
441│
442│ cwd = self._poetry.file.path.parent
→ 443│ env = self.get(reload=True)
444│
445│ if not env.is_sane():
9 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/env_manager.py:324 in get
322│ base_prefix = self.get_base_prefix()
323│
→ 324│ return VirtualEnv(prefix, base_prefix)
325│
326│ def list(self, name: str | None = None) -> list[VirtualEnv]:
8 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/virtual_env.py:44 in __init__
42│ # from inside the virtualenv.
43│ if base is None:
→ 44│ output = self.run_python_script(GET_BASE_PREFIX)
45│ self._base = Path(output.strip())
46│
7 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:313 in run_python_script
311│
312│ def run_python_script(self, content: str, **kwargs: Any) -> str:
→ 313│ return self.run(
314│ self._executable,
315│ "-I",
6 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:305 in run
303│ def run(self, bin: str, *args: str, **kwargs: Any) -> str:
304│ cmd = self.get_command_from_bin(bin) + list(args)
→ 305│ return self._run(cmd, **kwargs)
306│
307│ def run_pip(self, *args: str, **kwargs: Any) -> str:
5 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/virtual_env.py:88 in _run
86│ def _run(self, cmd: list[str], **kwargs: Any) -> str:
87│ kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
→ 88│ return super()._run(cmd, **kwargs)
89│
90│ def get_temp_environ(
4 ~/.local/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/utils/env/base_env.py:338 in _run
336│ output = ""
337│ else:
→ 338│ output = subprocess.check_output(
339│ cmd, stderr=stderr, env=env, text=True, **kwargs
340│ )
3 /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py:466 in check_output
464│ kwargs['input'] = empty
465│
→ 466│ return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
467│ **kwargs).stdout
468│
2 /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py:548 in run
546│ kwargs['stderr'] = PIPE
547│
→ 548│ with Popen(*popenargs, **kwargs) as process:
549│ try:
550│ stdout, stderr = process.communicate(input, timeout=timeout)
1 /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py:1026 in __init__
1024│ encoding=encoding, errors=errors)
1025│
→ 1026│ self._execute_child(args, executable, preexec_fn, close_fds,
1027│ pass_fds, cwd, env,
1028│ startupinfo, creationflags, shell,
FileNotFoundError
[Errno 2] No such file or directory: 'python'
at /opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py:1955 in _execute_child
1951│ err_filename = orig_executable
1952│ if errno_num != 0:
1953│ err_msg = os.strerror(errno_num)
1954│ if err_filename is not None:
→ 1955│ raise child_exception_type(errno_num, err_msg, err_filename)
1956│ else:
1957│ raise child_exception_type(errno_num, err_msg)
1958│ raise child_exception_type(err_msg)
The text was updated successfully, but these errors were encountered:
I've hit possibly the same issue. With the same result, the "[Errno 2] No such file or directory: 'python'"
tl; dr: I need to unset VIRTUAL_ENV
In my case it was due to bad interaction with VS code:
create a virtualenv: poetry env use python3.10
reload VS code windows. VS code detect the virtualenv
Open a new terminal inside VS code
Remove your virtualenv: peotry env remove my-package-ABC-py3.10
Command poetry env list and poetry env use python3.10
Fix:
reload VS code windows
open a new terminal
back to working state
The difference between broken state and working state is that when VS code detect the virtualenv, VS code "enable" it (but not as usual: PS1 isn't changed, deactivate function doesn't exist). Especially environment variable VIRTUAL_ENV is set, which poetry use. But since this point to the deleted virtualenv, python does not exist in that non-existing virtualenv.
Description
I'm a long-time Poetry-enthusiast ❤️ Amazing project and kudos to the whole team, thanks for all you do! 🎉 🌮 🍰
Since I have a workaround, I'm not terribly worried about this issue. That said, if it helps someone else I'm happy to provide a workaround & some information.
My workflow is basically:
Also, note that I have multiple versions of Python installed:
Workarounds
The workaround, which solves this issue for me is exactly as yene stated here: #6841 (comment)
Poetry Installation Method
pipx
Operating System
macOS 14.4
Poetry Version
Poetry (version 1.8.2)
Poetry Configuration
Python Sysconfig
Example pyproject.toml
Poetry Runtime Logs
With
-vvv
:The text was updated successfully, but these errors were encountered: