-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Cache invalidation broken with pyenv? #2130
Comments
I've sent a PR to the pyenv project that would fix this for the future, at least. See pyenv/pyenv#1981 |
To get around this temporarily, find out where virtualenv's cache is located and delete it:
|
I'd be happy to add a flag that disables the cache behaviour and pyenv users can set that on their profile (note there are a user-level virtualenv.ini where you can change the behaviour of virtualenv). PR in this sense are welcome. |
Issue
After installing a new Python point release
X.Y.Z+1
using pyenv on Mac,virtualenv -p X.Y
still uses the previous release from its cacheX.Y.Z
.This issue seems specific to Mac, I could not reproduce this on Linux.Update: I have just reproduced this on Linux, as well. See repro below.
Looking at the cache invalidation logic in
virtualenv.discovery.cached_py_info._get_via_file_cache
, the cause seems to be that the mtime of the pyenv shim forpythonX.Y
does not change when a newer version is installed.To reproduce, assuming a Mac with pyenv and virtualenv installed:
The first virtualenv invocation adds 3.7.9 to the cache. The second invocation still uses 3.7.9 for the environment, even though 3.7.10 is activated. The mtime of the shim for python3.7 never changes (even when doing a
pyenv rehash
).Expand for the full session with some debug statements inserted in _get_via_file_cache
Here is a reproduction for Linux using Docker:
Environment
Provide at least:
OS: Mac (
Darwin XYZ-MBP 18.7.0 Darwin Kernel Version 18.7.0: Mon Apr 27 20:09:39 PDT 2020; root:xnu-4903.278.35~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,1 Darwin
)pip list
of the host python wherevirtualenv
is installed:Output of the virtual environment creation
Make sure to run the creation with `-vvv --with-traceback`:
The text was updated successfully, but these errors were encountered: