-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poetry using the wrong Python version (not related to pyenv) #655
Comments
As you can see in |
Ah, here we go. It turns out |
@sdispater the issue is even worse. Poetry starting with 0.12.5 stopped working with the python version from the virtualenv, only checks system version of Python. After this command
If you would install it with sudo pip2 install poetry, it will work with python 2.7 projects, but won't work with python 3.6 projects. |
@sdispater Thanks, then these are different issues with the one from topic starter. |
@zmitchell Then, If I got it right, try reinstalling poetry. If installed with python2, it's bound to using python2 unless you use pyenv or virtualenv. |
I reinstalled with Python 3 using |
@zmitchell In 0.12.x, poetry is not bound to the interpreter version you curl the installer script through during installation -- so it doesn't matter which one you install it with with. If
|
Plese note that this option for the local .venv folder is broken in version 0.12.5 and will be fixed in version 0.12.10, which is not yet published (I rechecked it's not fixed in 0.12.9). |
@zmitchell For now, your best bet is to use |
@buriy Release |
@sdispater thanks a lot! |
Not sure if this is the original issue or a new Windows related issue (seeing this on 0.12.10 and 1.0.0a1).
Running |
I've also been running into issues trying to get poetry installing to the correct version of python when not using a virtual environment ( After doing some digging it looks like Ideally it would be nice to just use the version of python poetry was executed with when installing to the system environment. |
Using Poetry 1.0 (prerelease) seems to fix this issue:
See #731 for more information. |
@Peque Well the new |
This has been improved in the latest beta release (see #1477 for more information). |
The only thing that works for me (until i can use the new env feature) is running |
p.s. hi @tatianafrank! EDIT: Actually, no it didn't fix it. Despite the message that says it will use 3.8.0, the virtualenv uses poetry's python version:
Here's some debug information: As you can see, I'm using asdf (which is basically equivalent to pyenv but allows for multiple languages). Additionally, I have poetry installed via pipx (a common way to install python CLI tools in their own isolated virtualenvs):
|
None of the above works if youre trying to run poetry from crontab |
Using |
I think it would be nice to be able to specify For example Currently when I call
If I edit the pyproject.toml file to
Which is slightly confusing since no version of python has been "activated" at this point, and I have aliased python to python3, so it is only the |
I solve this problem on my Mac by replacing following line
to
in |
Just another copy&paste takeaway for the working solution on unix-systems: sed -i 's/#\!\/usr\/bin\/env python/#\!\/usr\/bin\/env python3/g' ~/.poetry/bin/poetry |
I have poetry version 1.1.4 installed via
When I attempt a Tried the
|
Poetry by default just uses the system Python, even if that is not supported by the version specifier in pyproject.toml. Poetry prints > The currently activated Python version 3.9.7 is not supported by the > project (3.8.10). > Trying to find and use a compatible version. > Using python3 (3.8.10) This message is misleading - it still uses the system Python! See <python-poetry/poetry#655> for details.
Poetry by default just uses the system Python, even if that is not supported by the version specifier in pyproject.toml. Poetry prints > The currently activated Python version 3.9.7 is not supported by the > project (3.8.10). > Trying to find and use a compatible version. > Using python3 (3.8.10) This message is misleading - it still uses the system Python! See <python-poetry/poetry#655> for details.
I still experience this, is there a new issue to subscribe to for the fix? |
Same issue here, is there any way to directly specify the python bin path for poetry? |
@dreamflasher poetry env use $(pyenv which python3.10) |
Thank you, but unfortunately this didn't work. I needed to add (sudo update-alternatives) a symlink to python3.9 as well as modify the poetry bin. |
Each step runs in its own process in GitHub Actions so environment changes are not preserved between steps. I may need to add this to the `poetry run ...` commands as well. I hope it's unnecessary. Apparently Poetry has some "well-known" issues with correctly detecting the desired Python version. See: * Poetry issue: python-poetry/poetry#655 * setup-python workaround: actions/setup-python#374 (comment)
Still an issue.
|
Yeah exactly |
poetry and pipenv select the python you specify on pyproject.toml or Pipfile, as long as they're findable in the PATH or similar. Those tools are not affected by pyenv shims. |
I don't even have |
Still an issue for me too, fresh pyenv and poetry install on WSL2, installed both using the official script. |
Even despite adsf did activate python3.8. This was not used by poetry. python-poetry/poetry#655 In the Make target I've added a command which ensures that the right python version is used.
* fix: Use right python environment Even despite adsf did activate python3.8. This was not used by poetry. python-poetry/poetry#655 In the Make target I've added a command which ensures that the right python version is used. * fix: for poetry command failures in netlify For some reason poetry started to fail with No module named 'poetry.repositories.http'. This works around that issue.
I use poetry 1.5.0 inside a docker container with asdf to handle python versions. Poetry was installed with python 3.8.10 (installed with asdf and set as global version). In .tool-versions I have The current project's Python requirement (>=2.7,<2.8 || >=3.4) is not compatible with some of the required packages Python requirement:
- pandas requires Python >=3.7.1, so it will not be satisfied for Python >=2.7,<2.8 || >=3.4,<3.7.1
Because XXX depends on pandas (1.3.5) which requires Python >=3.7.1, version solving failed. Which I don't get as I am using python 3.8.10.
Is there any specific volume or env var I need to pass in the docker container while running the poetry command? |
also still an issue for me. I am on poetry 1.5.1 and when i run
I get
you can see that the poetry environment is referencing a python 3.8. even |
@sumeeterito This issue is closed for a long time and yours seems unrelated to me. Please open a new ticket. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Question
I'm having an issue adding a package to a project because
poetry
is picking up on the wrong Python version. I'm pretty confident that something has gone awry in my system, but I'm doing my best to salvage the situation and not have to go through the whole process of installing Raspbian from scratch on this Raspberry Pi. I installedpoetry
using the recommended method (curl ...
). Can you point me in the right direction? As mentioned in the title, I'm not usingpyenv
. All of the relevant issues I found were related topyenv
, so I'm not really sure how to getpoetry
to use the correct Python.Here are some terminal outputs to help you diagnose the issue:
The text was updated successfully, but these errors were encountered: