question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip install fails with `ImportError: No module named pip._vendor` in pip==19.0.1

See original GitHub issue

Environment

  • pip version: 19.0.1
  • Python version: 2.7.14
  • OS: Debian GNU/Linux

Description

Hi guys, I ran into an unexpected pip install failure for a specific package after my CI silently upgraded pip to 19.0.1 (The problem is also present in pip==19.0 for what it is worth).

I am posting this as a new issue since it started to occur after an upgrade to pip, albeit I understand it may be an underlying issue with pendulum==1.4.4.

Thank you for reading this in advance!

Expected behavior

The following should succeed in a clean env with python 2.7.14 and pip 19:

pip install pendulum==1.4.4

How to Reproduce

This issue can be reproduced in a docker container stemming from the official python:2.7.14 docker image:

omarkhan$ docker run -it python:2.7.14 bash                                                                         omarkhan@Rion  6:19PM

root@a2286abe06a1:/# pip install -U pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl (1.4MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.4MB 3.5MB/s
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-19.0.1

root@a2286abe06a1:/# pip install pendulum==1.4.4
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pendulum==1.4.4
  Downloading https://files.pythonhosted.org/packages/85/a5/9fc15751f9725923b170ad37d6c61031fc9e941bafd5288ca6ee51233284/pendulum-1.4.4.tar.gz (74kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 81kB 502kB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  Complete output from command /usr/local/bin/python /usr/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpGuP1ar:
  Traceback (most recent call last):
    File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
      main()
    File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 54, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-_krb5E/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 115, in get_requires_for_build_wheel
      return _get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-_krb5E/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 101, in _get_build_requires
      _run_setup()
    File "/tmp/pip-build-env-_krb5E/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 85, in _run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 47, in <module>
      from build import *
    File "/usr/local/lib/python2.7/site-packages/pip/_vendor/pep517/build.py", line 7, in <module>
      from pip._vendor import pytoml
  ImportError: No module named pip._vendor

  ----------------------------------------
Command "/usr/local/bin/python /usr/local/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpGuP1ar" failed with error code 1 in /tmp/pip-install-ZDj3kd/pendulum

Notes

pip installing pendulum==1.4.4 in the packaged version of pip in a official python:2.7.14 docker container works as expected:

omarkhan$ docker run -it python:2.7.14 bash                                                                         omarkhan@Rion  6:20PM

root@39354b1b100d:/# pip list
Package    Version
---------- -------
pip        10.0.1
setuptools 39.1.0
virtualenv 15.2.0
wheel      0.31.0
You are using pip version 10.0.1, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

root@39354b1b100d:/# pip install pendulum==1.4.4
Collecting pendulum==1.4.4
  Downloading https://files.pythonhosted.org/packages/85/a5/9fc15751f9725923b170ad37d6c61031fc9e941bafd5288ca6ee51233284/pendulum-1.4.4.tar.gz (74kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 81kB 2.9MB/s
  Installing build dependencies ... done
Collecting python-dateutil<3.0.0.0,>=2.6.0.0 (from pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl (225kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 235kB 7.1MB/s
Collecting tzlocal<2.0.0.0,>=1.5.0.0 (from pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/cb/89/e3687d3ed99bc882793f82634e9824e62499fdfdc4b1ae39e211c5b05017/tzlocal-1.5.1.tar.gz
Collecting pytzdata>=2018.3.0.0 (from pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/46/8b/d7fe0c5b24870438d5ed59ceab72d537c5374d7db3cc57107e4a922b3a23/pytzdata-2018.7-py2.py3-none-any.whl (971kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 972kB 4.2MB/s
Collecting six>=1.5 (from python-dateutil<3.0.0.0,>=2.6.0.0->pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting pytz (from tzlocal<2.0.0.0,>=1.5.0.0->pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 512kB 8.0MB/s
Building wheels for collected packages: pendulum, tzlocal
  Running setup.py bdist_wheel for pendulum ... done
  Stored in directory: /root/.cache/pip/wheels/2f/4c/cd/f0cabf03ccb7edd9002875db9001108b33ebfc60b4ff9a61ae
  Running setup.py bdist_wheel for tzlocal ... done
  Stored in directory: /root/.cache/pip/wheels/15/ae/df/a67bf1ed84e9bf230187d36d8dcfd30072bea0236cb059ed91
Successfully built pendulum tzlocal
Installing collected packages: six, python-dateutil, pytz, tzlocal, pytzdata, pendulum
Successfully installed pendulum-1.4.4 python-dateutil-2.7.5 pytz-2018.9 pytzdata-2018.7 six-1.12.0 tzlocal-1.5.1
You are using pip version 10.0.1, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

It also works in pip==18.1:

omarkhan$ docker run -it python:2.7.14 bash                                                                         omarkhan@Rion  6:20PM

root@51c149c9b52a:/# pip install pip==18.1
Collecting pip==18.1
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.3MB 13.3MB/s
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-18.1
You are using pip version 18.1, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

root@51c149c9b52a:/# pip install pendulum==1.4.4
Collecting pendulum==1.4.4
  Downloading https://files.pythonhosted.org/packages/85/a5/9fc15751f9725923b170ad37d6c61031fc9e941bafd5288ca6ee51233284/pendulum-1.4.4.tar.gz (74kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 81kB 2.1MB/s
  Installing build dependencies ... done
Collecting python-dateutil<3.0.0.0,>=2.6.0.0 (from pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/74/68/d87d9b36af36f44254a8d512cbfc48369103a3b9e474be9bdfe536abfc45/python_dateutil-2.7.5-py2.py3-none-any.whl (225kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 235kB 4.7MB/s
Collecting tzlocal<2.0.0.0,>=1.5.0.0 (from pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/cb/89/e3687d3ed99bc882793f82634e9824e62499fdfdc4b1ae39e211c5b05017/tzlocal-1.5.1.tar.gz
Collecting pytzdata>=2018.3.0.0 (from pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/46/8b/d7fe0c5b24870438d5ed59ceab72d537c5374d7db3cc57107e4a922b3a23/pytzdata-2018.7-py2.py3-none-any.whl (971kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 972kB 13.6MB/s
Collecting six>=1.5 (from python-dateutil<3.0.0.0,>=2.6.0.0->pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting pytz (from tzlocal<2.0.0.0,>=1.5.0.0->pendulum==1.4.4)
  Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 512kB 2.2MB/s
Building wheels for collected packages: pendulum, tzlocal
  Running setup.py bdist_wheel for pendulum ... done
  Stored in directory: /root/.cache/pip/wheels/2f/4c/cd/f0cabf03ccb7edd9002875db9001108b33ebfc60b4ff9a61ae
  Running setup.py bdist_wheel for tzlocal ... done
  Stored in directory: /root/.cache/pip/wheels/15/ae/df/a67bf1ed84e9bf230187d36d8dcfd30072bea0236cb059ed91
Successfully built pendulum tzlocal
Installing collected packages: six, python-dateutil, pytz, tzlocal, pytzdata, pendulum
Successfully installed pendulum-1.4.4 python-dateutil-2.7.5 pytz-2018.9 pytzdata-2018.7 six-1.12.0 tzlocal-1.5.1
You are using pip version 18.1, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

7reactions
pipinetcommented, Jan 31, 2019

pip install pip===18.1

2reactions
resmocommented, Feb 10, 2019

pip install pip===19.0.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip3 install not working - No module named 'pip._vendor. ...
pip3 install --upgrade --user pip. Now the pip3 command fails ( ImportError: cannot import name 'main' ) because it's still called from theΒ ......
Read more >
No module named pip._vendor.pkg_resources
The "ModuleNotFoundError: No module named 'pip._vendor.pkg_resources'" is caused when pip is not installed or is outdated, most commonly onΒ ...
Read more >
ImportError: No module named 'pip._vendor.packaging'
I am using Ubuntu 21.10. I get this error: (foobar_addressbook) guettli@p15:~/foobar/projects/foobar_addressbook$ tox -e py35-django18 py35-Β ...
Read more >
Changelog - pip documentation v22.3.1
Fix import error when reinstalling pip in user site. ... You might be able to recover from this via: 'pip install --force-reinstall --no-deps...
Read more >
Bug #1880749 β€œUbuntu 20.04: virtualenv: pep517 requires ...
[Impact] * The pep517 module vendored in pip is missing its toml dependency. ... No module named 'toml' Ideally the virtualenv wouldn't even...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found