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

20b1: problems with namespace packages #1518

Closed
mgedmin opened this issue Jan 29, 2020 · 5 comments
Closed

20b1: problems with namespace packages #1518

mgedmin opened this issue Jan 29, 2020 · 5 comments

Comments

@mgedmin
Copy link

mgedmin commented Jan 29, 2020

I've decided to try running tox on all the Python projects I maintain with virtualenv 20.0.0b1, to check for regressions in the new beta. Three of the projects failed, all on Python 2.7:

  • gtimelog (python: No module named gtimelog; I've created 20b1: problems with editable installs #1517 for this one).
  • irclog2html (ImportError: No module named zope.testrunner)
  • zodbbrowser (ImportError: No module named zope.testrunner)

Here's how to reproduce the irclog2html/zodbbrowser issue (they're the same issue):

  • virtualenv -p python2.7 /tmp/venv
  • /tmp/venv/bin/pip install zope.testrunner
  • /tmp/venv/bin/python -c 'import zope.testrunner'

I expect: no output, the import should succeed.

I get

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named zope.testrunner

I suspect this was caused by zope being a namespace package. Incidentally import zope also fails. There's no __init__.py in the /tmp/venv/lib/python2.7/site-packages/zope directory.

I'm on Ubuntu 19.10. I installed virtualenv 20.0.0b1 with pipx install using my system Python 3.7.
pipx runpip virtualenv list produces

Package            Version 
------------------ --------
appdirs            1.4.3   
filelock           3.0.12  
importlib-metadata 1.5.0   
pip                20.0.2  
pkg-resources      0.0.0   
setuptools         45.1.0  
six                1.14.0  
virtualenv         20.0.0b1
wheel              0.34.1  
zipp               2.1.0   
@mgedmin
Copy link
Author

mgedmin commented Jan 29, 2020

For the record, when I create a virtualenv using an older version of virtualenv (15.1.0, packaged by Ubuntu 19.10), there's also no __init__.py in site-packages/zope. The namespace package magic is done via site-packages/zope.*-nspkg.pth files, and they're the same in both virtualenvs.

@gaborbernat
Copy link
Contributor

I think #1521 solves this. Please can you validate?

@mgedmin
Copy link
Author

mgedmin commented Jan 29, 2020

Yes, #1521 fixes this.

(Why does virtualenv on that branch say it is version 0.1.dev51+gd23e5ac? This makes tox 3.14.3 unhappy, due to its virtualenv>=16.0.0 version constraint. Anyway, that's immaterial and pip doesn't enforce version constraints anyway, only warns about them.)

@gaborbernat
Copy link
Contributor

gaborbernat commented Jan 29, 2020

Probably does not pull in the git tags from where the version is derived 🤔 how did you install the branch version?

@mgedmin
Copy link
Author

mgedmin commented Jan 29, 2020

git clone https://github.com/pypa/virtualenv
cd virtualenv
git pr 1521  # an alias that does git fetch origin +refs/pull/1521/head:refs/remotes/origin/pull/1521 && git checkout pull/1521
pipx runpip virtualenv install -e .

and yeah, there are no tags in the git history of this particular branch.

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants