Skip to content
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

Not using the right python environment in projects #4918

Closed
3 tasks done
pranasziaukas opened this issue Dec 21, 2021 · 2 comments
Closed
3 tasks done

Not using the right python environment in projects #4918

pranasziaukas opened this issue Dec 21, 2021 · 2 comments
Labels
kind/bug Something isn't working as expected

Comments

@pranasziaukas
Copy link

  • 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).

Issue

After a fresh install on macOS

➜ curl -sSL https://install.python-poetry.org | python3 -

poetry was added to ~/Library/Python/3.9/bin, which I thought was odd, but no complaints as long as it works:

➜ poetry --version
Poetry version 1.1.12

Created a default project pyproject.toml via poetry init, just changed the python version constraint to

python = "^3.10,<3.11"

I leverage pyenv to switch between different versions of python, so I did just that:

➜ pyenv local 3.10.0
➜ python --version
Python 3.10.0

At this point, I'd expect poetry to rely on the locally activated python version. But it doesn't:

➜ poetry install -vvv
The currently activated Python version 3.9.9 is not supported by the project (^3.10,<3.11).
Trying to find and use a compatible version.
Trying python3
Using python3 (3.10.0)
Creating virtualenv test-5f6I1Ta7-py3.10 in /Users/pranas/Library/Caches/pypoetry/virtualenvs
Using virtualenv: /Users/pranas/Library/Caches/pypoetry/virtualenvs/test-5f6I1Ta7-py3.10
Updating dependencies
Resolving dependencies...
   1: fact: test is 0.1.0
   1: derived: test
   1: selecting test (0.1.0)
   1: Version solving took 0.002 seconds.
   1: Tried 1 solutions.

Writing lock file

Finding the necessary packages for the current system

It claims that python v3.9.9 is activated, which is not true.
And the environment is wrong anyway:

➜ poetry env info

Virtualenv
Python:         3.9.9
Implementation: CPython
Path:           NA

System
Platform: darwin
OS:       posix
Python:   /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9

So, effectively, the appropriate python 3.10.0 is not accessible at all:

➜ poetry run python --version
The currently activated Python version 3.9.9 is not supported by the project (^3.10,<3.11).
Trying to find and use a compatible version.
Using python3 (3.10.0)
The virtual environment found in /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9 seems to be broken.
Recreating virtualenv test-5f6I1Ta7-py3.10 in /Users/pranas/Library/Caches/pypoetry/virtualenvs/test-5f6I1Ta7-py3.10
Python 3.9.9
@pranasziaukas pranasziaukas added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 21, 2021
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants