Poetry 0.12.3 uses Python 2.7.10 despite specifying 3.7.0
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: macOS Mojave
- Poetry version: 0.12.3
- Link of a Gist with the contents of your pyproject.toml file:
Issue
No matter what I do, Poetry uses Python 2.7.10.
For instance, I’ve downloaded and specified Python 3.7.0 with pyenv
:
$ pyenv install 3.7.0
$ pyenv local 3.7.0
My pyproject.toml
specifies:
[tool.poetry.dependencies]
python = "3.7.0"
...
Yet poetry update
yields:
[SolverProblemError]
The current supported Python versions are 2.7.10
Because hug (2.4.1) requires Python >=3.4
and no versions of hug match >2.4.1,<3.0.0, hug is forbidden.
So, because <...> depends on prodigy (1.6.1) which depends on hug (>=2.4.1,<3.0.0), version solving failed.
I’m completely mystified.
Infuriatingly, if I instead specify python = "3.2"
Poetry will gladly use Python 3.2…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:53 (14 by maintainers)
Top Results From Across the Web
Poetry doesn't use the correct version of Python
The currently activated Python version 2.7.16 is not supported by the project (^3.8). Trying to find and use a compatible version.
Read more >History | Poetry - Python dependency management and ...
Fix an issue where Git dependencies failed to clone when insteadOf was used in .gitconfig using the Dulwich Git client (#6506). Fix an...
Read more >pip install poetry==1.1.13
poetry is a tool to handle dependency installation as well as building and packaging of Python packages. It only needs one file to...
Read more >Get started with pyenv & poetry. Saviours in the python chaos!
Specify the python version for the local directory using pyenv pyenv local 3.7.5 # Create a new project, and directory poetry new ...
Read more >Poetry doens't use chosen python version
I'm trying to use Django 4.1.1 and Python 3.10.6. I specified PYTHON_VERSION environment variable to 3.10.6, but Poetry tries to use 3.7.10 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I realize this is a closed issue and I’m not suggesting repoening it, as there isn’t a bug (the program works as designed). However, the behavior is still not ideal, and I found this page because I was running into the same issues still today months later. Not being able to specify a Python version is a huge pain on some systems. In some cases you can’t just switch what the active version is.
So I suggest that being able to specify a Python version be a new feature if it isn’t on the roadmap. That behavior already exists with virtualenv with the
-p
option, so simply creating something in poetry that could forward along an argument to that would go a long way.Since I found this while doing random web searches for the problem I also wanted to point out a quick hack I used that effectively solved this problem for me in the hopes that it helps out others. Simply add an alias to your
.bashrc
or similar, like this:Voila, the
poetry
command now uses the version of Python you want.For what it’s worth, this should be considered a bug.
The official recommendation is to leave the primary
python
binary pointing to Python2 indefinitely to allow smooth co-existence of version-naive scripts, see PEP 394. Python 3.x is only supposed to be accessible bypython3
. If Python 2 is not installed, there should not be a/usr/bin/python
.Some distributions have chosen to break this packaging recommendation and in general it works OK as long as you’re using software from their repos, where they’ve replaced all the shebangs accordingly, but on many systems, including macOS, it can and will break things to link
/usr/bin/python
to the 3.x interpreter.While there’s been some discussion around whether the recommendation should be maintained long-term, given that the official recommendation is for
/usr/bin/python
to always point to the system’s Python 2.x interpreter, Poetry should not assume that/usr/bin/python
always represents the “activated interpreter”.