Poetry tries using Python2 (usr/local/bin/python) instead of the provided distribution during install
See original GitHub issue- Poetry version: Poetry (version 1.2.2)
- Python version: 3.11.0 (Poetry, Virtualenv and System shows this)
- OS version and name: Debian 11 (On WSL)
- pyproject.toml: https://gist.github.com/Taarek/3e0d5eada9102d5eb69d5145e5fc34f8#file-pyproject-toml
- I am on the latest stable Poetry version, installed using a recommended method.
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have consulted the FAQ and blog for any relevant entries or release notes.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption) and have included the output below. (https://gist.github.com/Taarek/3e0d5eada9102d5eb69d5145e5fc34f8#file-debug_logs-py)
Issue
I don’t have any reproducing steps, but I used to have Poetry 1.1-something, just earlier I uninstalled it to install 1.2.2.
I made sure to use python3.11 - after the curl command. But for whatever reason it still tries to use Python 2?
Whenever I try to run poetry update or poetry install it just fails with failed to query /usr/local/bin/python with code 2 err: 'No such file or directory' suddenly.
I tried searching for any existing issues, but searching for “No such file or directory” or “Wrong Python” or “Python 2” gives a ton of results, so apologies if this is a duplicate.
Edit: I did find this https://github.com/python-poetry/poetry/issues/6841 & #6371, but I tried what both the OP and the people replying suggested, and still get the same result.
Much later edit:
Doing poetry env use python3.10 then poetry install seems to work, so is this some weird Python 3.11 compatbility issue with Debian or something? (thinking about #6371) I did build Python 3.11 myself, don’t remember if I did that with Python 3.10 as well.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (1 by maintainers)

Top Related StackOverflow Question
In your case, it was because Ubuntu 22.04 ships with a different Python version from Ubuntu 20.04, and the symlink to the interpreter was busted. Beware of #6371 on Ubuntu 22.04 (you may need a deadsnakes or pyenv Python because of this Ubuntu bug).
I’m hoping this is resolved with virtualenv 20.16.7 which was just cut and should be pulled into new installs, including 1.1.15. Upstream python also accepted a fix into mainline and backported it to 3.11 that will try to fallback to a versioned binary if an unversioned one is referenced but not available in the path pointed to by
homeinpyvenv.cfg