pip: pip 9.0.2 KeyError: 'pip._vendor.urllib3.contrib'
- Pip version: 9.0.2
- Python version: 2.7.3, 2.7.13
- Operating system: Ubuntu 12.04, Ubuntu 16.04
In [1]: import urllib3.contrib
In [2]: import pip.pep425tags
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-2-9ae721442c45> in <module>()
----> 1 import pip.pep425tags
/home/<...>/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/__init__.py in <module>()
43 from pip.utils import get_installed_distributions, get_prog
44 from pip.utils import deprecation, dist_is_editable
---> 45 from pip.vcs import git, mercurial, subversion, bazaar # noqa
46 from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
47 from pip.commands import get_summaries, get_similar_commands
/home/<...>/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/vcs/mercurial.py in <module>()
7 from pip.utils import display_path, rmtree
8 from pip.vcs import vcs, VersionControl
----> 9 from pip.download import path_to_url
10 from pip._vendor.six.moves import configparser
11
/home/l<...>/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/download.py in <module>()
38 from pip.locations import write_delete_marker_file
39 from pip.vcs import vcs
---> 40 from pip._vendor import requests, six
41 from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
42 from pip._vendor.requests.auth import AuthBase, HTTPBasicAuth
/home/<...>/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py in <module>()
96
97 from . import utils
---> 98 from . import packages
99 from .models import Request, Response, PreparedRequest
100 from .api import request, get, head, post, patch, put, delete, options
/home/<...>/.virtualenvs/other-sabt/local/lib/python2.7/site-packages/pip/_vendor/requests/packages.py in <module>()
10 for mod in list(sys.modules):
11 if mod == package or mod.startswith(package + '.'):
---> 12 sys.modules['pip._vendor.requests.packages.' + mod] = sys.modules["pip._vendor." + mod]
13
14 # Kinda cool, though, right?
KeyError: 'pip._vendor.urllib3.contrib'
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (6 by maintainers)
Commits related to this issue
- pip import fixup for pip10 and https://github.com/pypa/pip/issues/5079 — committed to jantman/versionfinder by jantman 6 years ago
- Pin pip to 9.0.1 Importing pip 9.0.2 from the tests causes a crazy build failure. Apparently importing pip the way we do has never been supported and we should stop doing it. However, this stops the ... — committed to Kinto/kinto by glasserc 6 years ago
- Fix pip import error for compatibility with 9.0.2 Pip does a bunch of magic vendoring of packages for its internal use. In pip 9.0.2, the logic of this changed in a way such that it is sometimes nece... — committed to girder/girder by jbeezley 6 years ago
- 2.4.0 dns based discovery of deployment-handler - policy-handler uses dns based discovery of deployment-handler - driven by config - new data structure for deploy_handler section of config -- ... — committed to onap/dcaegen2-platform-policy-handler by alex-sh2020 6 years ago
- Enforce pip version during installation Currently there is a reported problem in pip library [1]. To avoid this problem, the pip version should be enforced during the installation. [1]https://github... — committed to opnfv/yardstick by deleted user 6 years ago
- Update git submodules * Update docs/submodules/yardstick from branch 'master' - Merge "Enforce pip version during installation" - Enforce pip version during installation Currently there ... — committed to opnfv/opnfvdocs by limingjiang 6 years ago
- Use built-in pkg_resources to get installed libraries Previously, we used internal pip code, which was changing in point releases, causing issues. We actually don't need pip to do this, we can instea... — committed to scoutapp/scout_apm_python by deleted user 6 years ago
- Update git submodules * Update docs/submodules/yardstick from branch 'master' - Merge "Re enable pip package unit tests" - Re enable pip package unit tests In [1] the pip unit test cases... — committed to opnfv/opnfvdocs by deleted user 6 years ago
- Re enable pip package unit tests In [1] the pip unit test cases were removed, because of a problem in pip3 library. Currently there is a reported error in pip 9.0.2 version, in _vendor.urllib3 librar... — committed to opnfv/yardstick by deleted user 6 years ago
- Gracefully ignore KeyError on isort import This is a workaround for `pip` 9.0.2, which is the version that runs on Heroku. For some reason, importing `isort` import imports `requests`, and if we imp... — committed to brainix/pottery by brainix 5 years ago
- Gracefully ignore isort import keyerror (#110) * Gracefully ignore KeyError on isort import This is a workaround for `pip` 9.0.2, which is the version that runs on Heroku. For some reason, impor... — committed to brainix/pottery by brainix 5 years ago
I think this would make an excellent issue to discuss the relative merits of doing that (or not doing it).
I’m seeing the same thing with pip 9.0.2 while running on the
python:3.6
docker containerI’ve been able to narrow it down to occurring when the
requests
library is imported before the pip library. Here’s an example:The reverse works fine: