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

ModuleNotFoundError: No module named 'pip' with 3.x-dev on Travis CI #1576

Closed
2 tasks done
hugovk opened this issue Feb 11, 2020 · 11 comments
Closed
2 tasks done

ModuleNotFoundError: No module named 'pip' with 3.x-dev on Travis CI #1576

hugovk opened this issue Feb 11, 2020 · 11 comments

Comments

@hugovk
Copy link
Contributor

hugovk commented Feb 11, 2020

If submitting a BUG please provide:

  • Minimal reproducible example or detailed descriptions
  • OS and pip list output

OS: Xenial
pip list: don't know, exception when running pip

  1. Build on Travis CI with .travis.yml:
language: python
dist: xenial

env:
  - VIRTUALENV_SEEDER=pip

python:
  - 'nightly'
  - '3.9-dev'
  - '3.8-dev'
  - '3.7-dev'
  - '3.6-dev'
  - 'pypy'
  - 'pypy3'
  - '3.8'
  - '3.7'
  - '3.6'
  - '3.5'
  - '2.7'

install:
  - pip install -U tqdm

script:
  - echo "$DIST"
  - lsb_release -a
  - python --version
  - python ./test.py

Expected result

Passes

Actual result

On 3.x-dev and nightly, there's a ModuleNotFoundError: No module named 'pip'.

Setting environment variables from .travis.yml
$ export VIRTUALENV_SEEDER=pip
0.00s$ source ~/virtualenv/pythonnightly/bin/activate
$ python --version
Python 3.9.0a3+
$ pip --version
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.9-dev/bin/pip", line 6, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

image

https://travis-ci.org/hugovk/test/builds/648978823

Also happens without VIRTUALENV_SEEDER=pip.

See also

The [Travis CI] build process does go through changes, of course, but for the most part they are pretty stable. If the *-dev version behaviors change, the changes are most likely due to the changes upstream.

https://travis-ci.community/t/python-development-versions-no-longer-include-pip/7180

@hugovk
Copy link
Contributor Author

hugovk commented Feb 11, 2020

This looks like it coincides with the release of virtualenv 20.

Passing build, yesterday:

Failing build, today:

@gaborbernat
Copy link
Contributor

@hugovk I don't see any virtualenv creation here, just activation? Who and where creates the virtual environments? They would need to use the pip seeder; or also cache the app-data folder, or we can copy the images.

@hugovk
Copy link
Contributor Author

hugovk commented Feb 11, 2020

@hugovk I don't see any virtualenv creation here, just activation? Who and where creates the virtual environments? They would need to use the pip seeder; or also cache the app-data folder, or we can copy the images.

@BanzaiMan / @native-api Hello, please could you answer this? ^

@native-api
Copy link

native-api commented Feb 11, 2020

I already identified the reason. @hugovk should have probably linked to that message for reference.

It’s a change in virtualenv‘s behavior in the latest version.
It now saves a couple of required files – including pip installation – outside the virtualenv’s subtree. Travis’ CPython compilation worker saves a premade virtualenv into a tarball to avoid recreating it each time – which now doesn’t include those files.

AFAICS, a workaround is to use --seeder=pip.


For the reference, with the now-default app-data seeder, is there a way to save a virtualenv into a tarball that guarantees its integrity and no conflicts when restored onto another machine?
It's being saved together with the corresponding pyenv-installed Python installation, and the other machine has the same arch and distro version.

@gaborbernat
Copy link
Contributor

gaborbernat commented Feb 11, 2020

@native-api you would have a few options, in an hour or so once #1579 is merged I'll release it part of 20.0.2:

@gaborbernat
Copy link
Contributor

This now has been fixed on our side, so I'll close the issue. Once we do the bugfix release I'll come back and post a message here.

@native-api
Copy link

@gaborbernat I confirm that with HEAD version, the virtualenv created with default options looks tarballable.

I'm though okay with using --seeder=pip since the speedup with app-data is very noticeable and our use case is indeed an unusual one.

So, what are your plans here? Do you plan to deprecate/remove --seeder=pip in the foreseeable future? Do you wish to eventually return symlinking as the default (just not so drastically)?

@gaborbernat
Copy link
Contributor

gaborbernat commented Feb 11, 2020

I think the pip seeder will be kept forever... Going ahead we'll keep copy for the app-data one the default, and allow users to change to symlink manually. 🤷‍♂ so the plan is to keep the status quo post this release for this major version (20.x series).

@gaborbernat
Copy link
Contributor

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

@native-api
Copy link

We went the --seeder=pip route, but nevertheless, confirming that the new tarballs are now live and usable.

@hugovk
Copy link
Contributor Author

hugovk commented Feb 13, 2020

Confirmed working, thank you very much for the quick fix, and also for maintaining and updating virtualenv! I've seen about a 30 second speedup running tox on a Mac.

@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

3 participants