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

[20.0.5+] entry points are not populated for editable installs in python 2 #1684

Closed
asottile opened this issue Mar 2, 2020 · 5 comments · Fixed by #1688
Closed

[20.0.5+] entry points are not populated for editable installs in python 2 #1684

asottile opened this issue Mar 2, 2020 · 5 comments · Fixed by #1688

Comments

@asottile
Copy link
Contributor

asottile commented Mar 2, 2020

demo script

#!/usr/bin/env bash
set -euxo pipefail

rm -rf venv venv2 pkg1

mkdir pkg1
cat >pkg1/setup.py <<EOF 
from setuptools import setup 
 
setup( 
    name='pkg1', 
    entry_points={'myep': ['myexp=os']}, 
) 
EOF

virtualenv venv
venv/bin/pip install 'virtualenv>20.0.5'
venv/bin/virtualenv venv2 -ppython2

venv2/bin/pip install -e ./pkg1
venv2/bin/python -c ' 
import pkg_resources; print(list(pkg_resources.iter_entry_points("myep"))) 
'

output with >

$ ./t.sh 
+ rm -rf venv venv2 pkg1
+ mkdir pkg1
+ cat
+ virtualenv venv
created virtual environment CPython3.6.9.final.0-64 in 193ms
  creator CPython3Posix(dest=/tmp/x/venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/asottile/.local/share/virtualenv/seed-app-data/v1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
+ venv/bin/pip install 'virtualenv>20.0.5'
Collecting virtualenv>20.0.5
  Using cached virtualenv-20.0.7-py2.py3-none-any.whl (8.0 MB)
Processing /home/asottile/.cache/pip/wheels/6e/e8/db/c73dae4867666e89ba3cfbc4b5c092446f0e584eda6f409cbb/distlib-0.3.0-cp36-none-any.whl
Collecting six<2,>=1.9.0
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting filelock<4,>=3.0.0
  Using cached filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting appdirs<2,>=1.4.3
  Using cached appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
Collecting importlib-resources<2,>=1.0; python_version < "3.7"
  Using cached importlib_resources-1.1.0-py2.py3-none-any.whl (30 kB)
Collecting importlib-metadata<2,>=0.12; python_version < "3.8"
  Using cached importlib_metadata-1.5.0-py2.py3-none-any.whl (30 kB)
Collecting zipp>=0.4; python_version < "3.8"
  Using cached zipp-3.0.0-py3-none-any.whl (4.8 kB)
Installing collected packages: distlib, six, filelock, appdirs, zipp, importlib-resources, importlib-metadata, virtualenv
Successfully installed appdirs-1.4.3 distlib-0.3.0 filelock-3.0.12 importlib-metadata-1.5.0 importlib-resources-1.1.0 six-1.14.0 virtualenv-20.0.7 zipp-3.0.0
+ venv/bin/virtualenv venv2 -ppython2
created virtual environment CPython2.7.17.final.0-64 in 169ms
  creator CPython2Posix(dest=/tmp/x/venv2, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/asottile/.local/share/virtualenv/seed-app-data/v1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator
+ venv2/bin/pip install -e ./pkg1
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Obtaining file:///tmp/x/pkg1
Installing collected packages: pkg1
  Running setup.py develop for pkg1
Successfully installed pkg1
+ venv2/bin/python -c '
import pkg_resources; print(list(pkg_resources.iter_entry_points("myep")))
'
[]

changing the > to a <

$ ./t.sh 
+ rm -rf venv venv2 pkg1
+ mkdir pkg1
+ cat
+ virtualenv venv
created virtual environment CPython3.6.9.final.0-64 in 191ms
  creator CPython3Posix(dest=/tmp/x/venv, clear=False, global=False)
  seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=/home/asottile/.local/share/virtualenv/seed-app-data/v1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
+ venv/bin/pip install 'virtualenv<20.0.5'
Collecting virtualenv<20.0.5
  Using cached virtualenv-20.0.4-py2.py3-none-any.whl (4.6 MB)
Collecting six<2,>=1.9.0
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Processing /home/asottile/.cache/pip/wheels/6e/e8/db/c73dae4867666e89ba3cfbc4b5c092446f0e584eda6f409cbb/distlib-0.3.0-cp36-none-any.whl
Collecting filelock<4,>=3.0.0
  Using cached filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting importlib-resources<2,>=1.0; python_version < "3.7"
  Using cached importlib_resources-1.1.0-py2.py3-none-any.whl (30 kB)
Collecting importlib-metadata<2,>=0.12; python_version < "3.8"
  Using cached importlib_metadata-1.5.0-py2.py3-none-any.whl (30 kB)
Collecting appdirs<2,>=1.4.3
  Using cached appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
Collecting zipp>=0.4; python_version < "3.8"
  Using cached zipp-3.0.0-py3-none-any.whl (4.8 kB)
Installing collected packages: six, distlib, filelock, zipp, importlib-resources, importlib-metadata, appdirs, virtualenv
Successfully installed appdirs-1.4.3 distlib-0.3.0 filelock-3.0.12 importlib-metadata-1.5.0 importlib-resources-1.1.0 six-1.14.0 virtualenv-20.0.4 zipp-3.0.0
+ venv/bin/virtualenv venv2 -ppython2
created virtual environment in 179ms CPython2Posix(dest=/tmp/x/venv2, clear=False, global=False) with seeder FromAppData pip=latest setuptools=latest wheel=latest app_data_dir=/home/asottile/.local/share/virtualenv/seed-v1 via=copy
+ venv2/bin/pip install -e ./pkg1
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Obtaining file:///tmp/x/pkg1
Installing collected packages: pkg1
  Running setup.py develop for pkg1
Successfully installed pkg1
+ venv2/bin/python -c '
import pkg_resources; print(list(pkg_resources.iter_entry_points("myep")))
'
[EntryPoint.parse('myexp = os')]
@asottile asottile added the bug label Mar 2, 2020
@asottile asottile changed the title [20.0.5+] entry points are not populated for editable installs [20.0.5+] entry points are not populated for editable installs in python 2 Mar 2, 2020
@gaborbernat
Copy link
Contributor

Sounds like a pip bug if anything, but let's find out what causes this behaviour 🤔and escalate from there.

@asottile
Copy link
Contributor Author

asottile commented Mar 2, 2020

I think the problem is import setuptools inside site.py -- this happens before .pth files are initialized so the working_set does not contain the installs due to easy_install.pth

@gaborbernat
Copy link
Contributor

Hmm still sounds like a bug, setuptools should work independent of pth imports before or not 🤔

@asottile
Copy link
Contributor Author

asottile commented Mar 2, 2020

the working set is instantiated only once at import time -- it assumes (and probably pretty reasonably) that site has already finished at that point

@gaborbernat
Copy link
Contributor

Hello, a fix for this issue has been released via virtualenv 20.0.8; see https://pypi.org/project/virtualenv/20.0.8/ (https://virtualenv.pypa.io/en/latest/changelog.html#v20-0-8-2020-03-04). 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.
thanks

@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants