-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Issues with virtual environment reuse and multiple Python versions installed through pyenv
#441
Comments
Can you verify that I have seen similar behavior on macOS, though my situation was slightly different from the one you described. To my knowledge, virtualenv does not invalidate its cache when you install a newer point release (X.Y.Z) of Python using pyenv. Its cache invalidation code only checks the mtime of the pyenv shim, which does not change. Nox will refuse to reuse the environment because the interpreter does not have the expected version. (That's not to say that Nox can't support this case better.) Also, which OS are you using? |
I'm not entirely sure what steps to take but when I did
As opposed to using
The former seems to occur because of how I've installed As a workaround, Installing
I'm on Linux. |
Thanks for the additional input! I think what's going on here is this: Nox decides whether it can reuse the environment by comparing the base prefix of the installed interpreter with the base prefix of the expected interpreter. In your case, these two are different:
So fixing the upstream bug mentioned above won't do anything for your use case. The versions of both interpreters are identical, only their base prefix differs. I think there are (at least) two ways in which Nox's behavior could be improved here:
The second point may be irrelevant if we find a good solution for the first one. But I'm not yet sure what that would be. |
This was fixed in Nox 2021.6.12. |
Describe the bug
G'day, Nox 2021.6.6 seems to fail reusing environments when it finds multiple Python interpreters installed by
pyenv
. Perhaps this is related to #428 ?How to reproduce
Install multiple versions with
pyenv
This populates
~/.pyenv/shims/
with the following with executable scripts e.g.python
,python3.9
,python3.8
, etc. This folder is typically added toPATH
.Running the following session breaks virtual environment reuse:
Installing/running
nox
usingpoetry
or a manually-createdvirtualenv
environment in a project seems to resolve this, however.Expected behavior
Virtual environments are reused in the presence of
pyenv
-installed Python versions.The text was updated successfully, but these errors were encountered: