poetry: Ubuntu 20.04 without python-as-python3 apt package errors No such file or directory: 'python'
- 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.8
Issue
Attempting to run any poetry commands results in
Installing dependencies
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,
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,
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,
Env Info:
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,
In ubuntu 20.04 there is not “python” command, only “python3”. If I install sudo apt-get install python-is-python3
, then poetry starts to work again.
It would be nice if poetry picked python3 if there is no python instead of failing. There is a python installed.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 11
- Comments: 26 (4 by maintainers)
Commits related to this issue
- Avoid poetry 1.1.8 python issue https://github.com/python-poetry/poetry/issues/4416 — committed to yshym/watch-with-friends by yshym 3 years ago
- Avoid poetry 1.1.8 python issue https://github.com/python-poetry/poetry/issues/4416 — committed to yshym/watch-with-friends by yshym 3 years ago
- Avoid poetry 1.1.8 python issue https://github.com/python-poetry/poetry/issues/4416 — committed to yshym/watch-with-friends by yshym 3 years ago
I have this issue as well
Thanks for your response! I’m able to reproduce it. It seems to be due to a change in poetry 1.1.8. I have no problems with 1.1.7. I guess https://github.com/python-poetry/poetry/issues/4414 is somehow related.
Should be fixed via https://github.com/python-poetry/poetry/pull/4507
I can confirm this too in Alpine 3.13.5. I didn’t lock poetry to a specific version in our build pipeline and started seeing the following error:
Poetry is installed into the Alpine image using
pip3
. Pinning it usingpip3 install poetry==1.1.7
resolved the issue. Alpine (as well as the Ubuntu version listed above) do not create a symbolic link from python->python3.x and it seems 1.1.8 somehow introduced spawning the interpreter by that name in a subprocess call.Just remove virtual environment directory. If you enabled virtualenvs.in-project you need to remove ‘.venv’ in your project directory.
(WSL) i seem to still get this issue after installing today via
reinstalling python3.9 does not seem to resolve
reinstalling poetry receives
as i uninstalled python-is-python3, aliases and that would have removed the alternatives aliases
edit:
this was fixed via https://lifesaver.codes/answer/include-installation-instructions-for-python3-721
where this is suggested:
however
poetry run
still failsedit again
solves this, leaving this here for others as this was google top result for me