-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Regression: Poetry uses the wrong version of Python #120502
Comments
Interestingly, in the commit that I believe broke it, there's a test that attempts to test for regressions of #62910, but the test uses This test no longer exists in the latest version of the formula. homebrew-core/Formula/poetry.rb Lines 205 to 214 in 763ca9d
|
Homebrew's installation is similar to the documented manual installation (https://python-poetry.org/docs/#installing-manually) as we essentially do a I think the official installer also just installs into a venv which adds the corresponding venv shebang. Shebangs are generated by Given above, this seems more like an upstream issue, maybe python-poetry/poetry#7158 EDIT: Quoting from above issue python-poetry/poetry#7158 (comment)
This sounds like what you are experiencing, i.e. output claims to have found |
This may be fixable upstream, but I'm unable to replicate the problem when poetry is installed with the official install instructions. Something is different between what Brew is doing and what the official installer is doing, and that something is triggering the bug (at least for me). However, you are correct that the one from the official installer also hardcodes the python in the shebang: |
Will keep an eye on python-poetry/poetry#7221 (PR) to see if the upstream fix also applies here though. EDIT: that's merged, now following python-poetry/poetry#7357 |
@sargunv thanks so much for the mentioned workaround:
I was literally spending hours and hours on why my poetry kept falling back to python 3.11 instead of 3.9. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
should be fixed in 1.4.0 |
Still having this issue. |
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output" saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
Trying to
poetry install
with Python v3.8.13 in my PATH, in a project that requires Python >=3.8.5,<3.10.0 according to its pyproject.toml.The python in my PATH is v3.8.13 (from pyenv):
The python required by my project using Poetry is >=3.8.5,<3.10.0
So, a
poetry install
in this project should work.What happened (include all command output)?
Poetry somehow runs with Python 3.11.1, so
poetry install
fails as 3.11.1 does not meet the constraints in the project:Even
poetry env list
shows the venv is named as if it's a 3.8 venv:With
poetry env info
we can see that poetry is ignoring my PATH and instead using the python from its homebrew package:And here's the culprit. TheEDIT: official installer does too, and does not exhibit the same bug.#!
of the poetry bin hardcodes the Python path.What did you expect to happen?
I expected Poetry to use the Python from my PATH to install the project I'm working on (that's compatible with the Python from my PATH).
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: