# Python development versions no longer include pip (due to virtualenv 20.x)

**URL:** <https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180>\
**Category:** Python\
**Created:** [February 11, 2020, 5:53am UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180 "2020-02-11T05:53:45Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![quentinp](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/quentinp/32/5073_2.png) [@quentinp](https://travis-ci.community/u/quentinp)\
**Post date:** [February 11, 2020, 5:53am UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/1 "2020-02-11T05:53:45Z")

</div>

Nothing changed on our side between our [last good build](https://travis-ci.org/python-trio/trio/builds/648263355) and our [first bad build](https://travis-ci.org/python-trio/trio/builds/648727502), but all Python development versions (3.5-dev, 3.6-dev, 3.7-dev, 3.8-dev and nightly) fail with the following error:

```auto
$ pip --version
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.8-dev/bin/pip", line 6, in <module>
    from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip'

```

Is it possible to get back the old behavior? Or should we install pip ourselves?

Thanks!

---

<div class="post-metadata">

**Author:** ![kingjulianza](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kingjulianza](https://travis-ci.community/u/kingjulianza)\
**Post date:** [February 11, 2020, 9:31am UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/2 "2020-02-11T09:31:05Z")

</div>

Getting the same thing on our side. Yesterday the build was working and today its failing with that error. Nothing has changed.

---

<div class="post-metadata">

**Author:** ![michalpristas](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/michalpristas/32/3810_2.png) [@michalpristas](https://travis-ci.community/u/michalpristas)\
**Post date:** [February 11, 2020, 12:05pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/3 "2020-02-11T12:05:15Z")

</div>

+1 but with

```auto
$ python --version
Python 2.7.17

```

the issue started yesterday

```auto
  File "...build/ve/darwin/bin/pip", line 6, in <module>
    from pip._internal.cli.main import main
ImportError: No module named main

```

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [February 11, 2020, 12:22pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/4 "2020-02-11T12:22:02Z")

</div>

> [@michalpristas](#):
>
> ImportError: No module named main

That’s unrelated. You are relying on undocumented internals of Pip, and they have changed.

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [February 11, 2020, 1:41pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/5 "2020-02-11T13:41:17Z")

</div>

You can look at the recent build history at [https://travis-ci.com/travis-ci/cpython-builder/builds](https://travis-ci.com/travis-ci/cpython-builder/builds). If you are interested in finding your Python version build log, you can use the CLI:

```
$ travis history --limit 100 --com -r travis-ci/cpython-builder | grep VERSION=3\.5-dev
#8019 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200211T103640Z
#8012 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200210T103548Z
#8005 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200209T103354Z
#7998 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200208T103311Z
#7985 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200206T103831Z
#7978 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200205T103443Z
#7971 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200204T103350Z
#7964 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200203T103121Z
#7957 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200202T102952Z
#7950 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200201T103009Z
#7943 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200131T102807Z
#7936 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200130T152259Z
#7929 passed: default build branch=default; source=rake; env="VERSION=3.5-dev" 20200129T102653Z
$ travis open --com -r travis-ci/cpython-builder 8012
```

The 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.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [February 11, 2020, 3:43pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/6 "2020-02-11T15:43:02Z")

</div>

Identified the reason. 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.

I don’t yet know if it’s possible to change that, or to somehow reliably figure out which external files to include and guarantee that the virtualenv will work on a different system.

---

<div class="post-metadata">

**Author:** ![hugovk](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hugovk/32/684_2.png) [@hugovk](https://travis-ci.community/u/hugovk)\
**Post date:** [February 11, 2020, 4:04pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/7 "2020-02-11T16:04:37Z")

</div>

Yep, virtualenv 20 was released yesterday. I’ve opened an issue on their tracker:

> <https://github.com/pypa/virtualenv/issues/1576>
>
> Thanks for submitting an issue!
> If submitting a BUG please provide:
> Minimal reproducible example or detailed descriptions
> OS and pip list output
> OS:...

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [February 11, 2020, 5:59pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/8 "2020-02-11T17:59:31Z")

</div>

If there is a Python release before the issue is fixed, they will likely be affected by this issue.

---

<div class="post-metadata">

**Author:** ![hugovk](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hugovk/32/684_2.png) [@hugovk](https://travis-ci.community/u/hugovk)\
**Post date:** [February 11, 2020, 6:45pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/9 "2020-02-11T18:45:40Z")

</div>

Virtualenv have already made a fix and released it as 20.0.2!

> <https://github.com/pypa/virtualenv/issues/1576#issuecomment-584768922>
>
> If submitting a BUG please provide:
> Minimal reproducible example or detailed descriptions
> OS and pip list output
> OS: Xenial
> pip list: don't know,...

> <https://github.com/pypa/virtualenv/issues/1576#issuecomment-584779303>
>
> If submitting a BUG please provide:
> Minimal reproducible example or detailed descriptions
> OS and pip list output
> OS: Xenial
> pip list: don't know,...

Is there something that needs to be done on the Travis side to update? Thanks!

---

<div class="post-metadata">

**Author:** ![BanzaiMan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/banzaiman/32/67_2.png) [@BanzaiMan](https://travis-ci.community/u/BanzaiMan)\
**Post date:** [February 11, 2020, 7:20pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/10 "2020-02-11T19:20:15Z")

</div>

Within 24 hours the next build will kick off, then those will be transported to the place builds can use shortly thereafter.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [February 11, 2020, 9:48pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/11 "2020-02-11T21:48:02Z")

</div>

> <https://github.com/travis-ci/cpython-builder/pull/35>

Used a more future-proof solution. There are also environment changes in Multiarch images that also required adapting the code to (that’s why 3.9-dev builds were failing).

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [February 12, 2020, 2:48pm UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/12 "2020-02-12T14:48:09Z")

</div>

An automatic build [has run successfully at 3:46 UTC](https://travis-ci.com/travis-ci/cpython-builder/builds/148511198).

However, OP’s last build [run at 9:54 UTC](https://travis-ci.org/python-trio/trio/jobs/649365649) is still failing due to a defective tarball.

[I’ve double-checked](https://travis-ci.org/native-api/cpython-builder/jobs/649427406#L17025) that tarballs created after the fix are okay.

AFAICS, automatic builds [upload artifacts to `s3.amazonaws.com`](https://travis-ci.com/travis-ci/cpython-builder/jobs/286184496#L9780), however, user builds [download them from `storage.googleapis.com` instead](https://travis-ci.org/python-trio/trio/jobs/649365649#L170).

Is there a large gap between automatic build time and synchronizing the two cloud storages or something?

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [February 13, 2020, 1:44am UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/13 "2020-02-13T01:44:31Z")

</div>

Okay, now the `storage.googleapis.com` tarball has correct contents (timestamped 11:43 UTC, likely from the next automatic build).

[Confirmed that the -dev builds now work.](https://travis-ci.org/native-api/trio/builds/649747522)

---

<div class="post-metadata">

**Author:** ![quentinp](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/quentinp/32/5073_2.png) [@quentinp](https://travis-ci.community/u/quentinp)\
**Post date:** [February 13, 2020, 6:19am UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/14 "2020-02-13T06:19:57Z")

</div>

Thanks everyone for the help! ❤

---

<div class="post-metadata">

**Author:** ![hugovk](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/hugovk/32/684_2.png) [@hugovk](https://travis-ci.community/u/hugovk)\
**Post date:** [February 13, 2020, 8:30am UTC](https://travis-ci.community/t/python-development-versions-no-longer-include-pip-due-to-virtualenv-20-x/7180/15 "2020-02-13T08:30:02Z")

</div>

Thank you! Also confirmed working for `3.6-dev` to `3.9-dev` and `nightly`.
