-
-
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
.dist-info.virtualenv
marker files break importlib.metadata in app-data seeded venvs
#1589
Comments
This indeed is a really bad choice of name on our side; will create a PR to fix this (which will land today). |
If I'm not mistaken, the issue only affects the following environments:
Python >= 3.8.2rc1 and importlib_metadata >= 1.4 use stricter matching and will not pick up the marker files. Need to check that... Update: As expected:
|
Hello, a fix for this issue has been released via virtualenv 20.0.2; see https://pypi.org/project/virtualenv/20.0.3/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-3-2020-02-12) . Please give a try and report back if your issue has not been addressed; if not, please comment here, and we'll reopen the ticket. We want to apologize for the inconvenience this has caused you and say thanks for having patience while we resolve the unexpected bugs with this new major release. |
That fixes it, many thanks :) |
If this issue still affects you after upgrading to virtualenv 20.0.3, the reason may be that you have app data generated by an earlier version of 20.0. virtualenv will continue to use this data to generate new environments. A simple way to resolve this is by deleting the app data directory, for example:
Find out the location of the app data by running the following (preferably inside a virtualenv): pip install appdirs
python -c 'import appdirs; print(appdirs.user_data_dir(appname="virtualenv", appauthor="pypa"))' |
Hmm every version should have it's own app data 🤔it's a bug if not 😊 |
I still had this after upgrading: $ ls ~/Library/Application\ Support/virtualenv/seed-v1/3.7/image/CopyPipInstall/pip-20.0.2-py2.py3-none-any/
pip/ pip-20.0.2.dist-info/ pip-20.0.2.dist-info.virtualenv |
It's a bug then 😟 |
Since virtualenv 20.0.0, dist-info directories in virtual environments seeded using the
app-data
method are accompanied by empty marker files with the same name as the directory plus a.virtualenv
suffix:virtualenv/src/virtualenv/seed/via_app_data/pip_install/base.py
Lines 73 to 76 in c8ac632
This breaks
importlib.metadata
, which picks these files up and attempts to createimportlib.metadata.Distribution
instances for them. As a result, something likeimportlib.metadata.version("pip")
will returnNone
.The following session was run in a virtual environment created by virtualenv 20.0.2 inside a
python:3.8.1
Docker image:This may in fact be an issue in
importlib.metadata
. I'm reporting it here in the assumption that virtualenv may be able to fix or work around this issue faster, and that it would need to work around the issue anyway for Python 3.8.0 and 3.8.1.The issue also causes Poetry to break when invoked inside such virtual environments, for example in Nox and tox: python-poetry/poetry#1953. This is currently affecting projects that use Poetry in their CI pipelines.
The text was updated successfully, but these errors were encountered: