[Errno 2] No such file or directory: 'python' on almost all poetry commands
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: Ubuntu 20.04
- Poetry version: 1.1.10
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/dfontenot/bdaa7940af0a9bc72c41e91500072880#file-pyproject-toml
Issue
Running into an issue in which I cannot run many Poetry commands in my project (e.g. poetry update
, poetry shell
, etc.). Tried in both zsh and bash. I get the error [Errno 2] No such file or directory: 'python'
. I initially set up this project with the default settings, but Iβve since changed virtualenvs.create
and virtualenvs.in-project
to be true. Since this change I get these errors. Deleting the .venv/ directory in the project directory does not fix the issue.
Hereβs my current ~/.config/pypoetry/config.toml
[virtualenvs]
create = true
in-project = true
Output of poetry config --list
(if that helps):
cache-dir = "/home/david/snap/alacritty/common/.cache/pypoetry"
experimental.new-installer = true
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = true
virtualenvs.path = "{cache-dir}/virtualenvs" # /home/david/snap/alacritty/common/.cache/pypoetry/virtualenvs
Iβve found that if I completely comment out my ~/.config/pypoetry/config.toml
file, I am then able to run poetry shell
, which it appears to be installing in the default cache-dir directory. However, I would like to have my virtualenvs in the individual projects.
Output of poetry shell -vvv
:
Stack trace:
14 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/console_application.py:131 in run
129β parsed_args = resolved_command.args
130β
β 131β status_code = command.handle(parsed_args, io)
132β except KeyboardInterrupt:
133β status_code = 1
13 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:120 in handle
118β def handle(self, args, io): # type: (Args, IO) -> int
119β try:
β 120β status_code = self._do_handle(args, io)
121β except KeyboardInterrupt:
122β if io.is_debug():
12 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py:163 in _do_handle
161β if self._dispatcher and self._dispatcher.has_listeners(PRE_HANDLE):
162β event = PreHandleEvent(args, io, self)
β 163β self._dispatcher.dispatch(PRE_HANDLE, event)
164β
165β if event.is_handled():
11 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/event/event_dispatcher.py:22 in dispatch
20β
21β if listeners:
β 22β self._do_dispatch(listeners, event_name, event)
23β
24β return event
10 ~/.poetry/lib/poetry/_vendor/py3.8/clikit/api/event/event_dispatcher.py:89 in _do_dispatch
87β break
88β
β 89β listener(event, event_name, self)
90β
91β def _sort_listeners(self, event_name): # type: (str) -> None
9 ~/.poetry/lib/poetry/console/config/application_config.py:119 in set_env
117β
118β env_manager = EnvManager(poetry)
β 119β env = env_manager.create_venv(io)
120β
121β if env.is_venv() and io.is_verbose():
8 ~/.poetry/lib/poetry/utils/env.py:659 in create_venv
657β
658β cwd = self._poetry.file.parent
β 659β env = self.get(reload=True)
660β
661β if not env.is_sane():
7 ~/.poetry/lib/poetry/utils/env.py:531 in get
529β base_prefix = self.get_base_prefix()
530β
β 531β return VirtualEnv(prefix, base_prefix)
532β
533β def list(self, name=None): # type: (Optional[str]) -> List[VirtualEnv]
6 ~/.poetry/lib/poetry/utils/env.py:1361 in __init__
1359β if base is None:
1360β self._base = Path(
β 1361β self.run(self._executable, "-", input_=GET_BASE_PREFIX).strip()
1362β )
1363β
5 ~/.poetry/lib/poetry/utils/env.py:1140 in run
1138β bin = self._bin(bin)
1139β cmd = [bin] + list(args)
β 1140β return self._run(cmd, **kwargs)
1141β
1142β def run_python(self, *args, **kwargs):
4 ~/.poetry/lib/poetry/utils/env.py:1440 in _run
1438β def _run(self, cmd, **kwargs):
1439β kwargs["env"] = self.get_temp_environ(environ=kwargs.get("env"))
β 1440β return super(VirtualEnv, self)._run(cmd, **kwargs)
1441β
1442β def get_temp_environ(
3 ~/.poetry/lib/poetry/utils/env.py:1165 in _run
1163β
1164β if input_:
β 1165β output = subprocess.run(
1166β cmd,
1167β stdout=subprocess.PIPE,
2 ~/.poetry/lib/poetry/utils/_compat.py:200 in run
198β kwargs["stdin"] = PIPE
199β
β 200β process = Popen(*popenargs, **kwargs)
201β try:
202β process.__enter__() # No-Op really... illustrate "with in 2.4"
1 /usr/lib/python3.8/subprocess.py:858 in __init__
856β encoding=encoding, errors=errors)
857β
β 858β self._execute_child(args, executable, preexec_fn, close_fds,
859β pass_fds, cwd, env,
860β startupinfo, creationflags, shell,
FileNotFoundError
[Errno 2] No such file or directory: 'python'
at /usr/lib/python3.8/subprocess.py:1704 in _execute_child
1700β else:
1701β err_filename = orig_executable
1702β if errno_num != 0:
1703β err_msg = os.strerror(errno_num)
β 1704β raise child_exception_type(errno_num, err_msg, err_filename)
1705β raise child_exception_type(err_msg)
1706β
1707β
1708β def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED,
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14 (3 by maintainers)
Removing the cache helped for me:
Installing the latest version solved this issue.