Pip: ImportError: No module named 'pip._vendor.requests'

Created on 12 Jan 2015  路  26Comments  路  Source: pypa/pip

I installed python 2.7.5 and run python get-pip.py, system come out this error:
Traceback (most recent call last):

  File "get-pip.py", line 19892, in <module>
    main()
  File "get-pip.py", line 152, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip
  File "/tmp/tmpwUQJB5/pip.zip/pip/__init__.py", line 15, in <module>

  File "/tmp/tmpwUQJB5/pip.zip/pip/vcs/mercurial.py", line 11, in <module>
  File "/tmp/tmpwUQJB5/pip.zip/pip/download.py", line 30, in <module>
  File "/tmp/tmpwUQJB5/pip.zip/pip/_vendor/__init__.py", line 81, in load_module

ImportError: No module named 'pip._vendor.requests'
auto-locked

Most helpful comment

Same issue here with ubuntu. 12.04, upgrading system packages fixed it:

$ sudo pip install -U requests
$ sudo pip install -U pip

EDIT : Issue still there in deed... investigating

EDIT : ok, a complete requests uninstall and install back via pip fixed the issue.

All 26 comments

Seconded. I have started seeing the same issue too.

i have the same issue too.....
please Help

I have python 2.7.8 and have the same issue.

I am having the same issue in one of my virtualenv (only this one). It started after I used add2virtualenv to add a directory to get sip module picked up.

i have the same issue too.....

Just ran into this as well. It seems like the error message is wrong... ensuring that python is compiled with ssl support definitely fixes the issue for me.

% python
Python 2.7.9 (default, Jan 27 2015, 17:42:45)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>

If the above yields errors, it may be the cause of your issues.

See also: http://stackoverflow.com/questions/23548188/how-do-i-compile-python-3-4-with-custom-openssl

I encountered same problem on my CentsOS. After steps below, this issue was fixed:
1) yum install openssl_devel
2)recompile python: make && make install.
Maybe useful to you.

I had same problem on Debian - python had ssl support, but pip installed by virtualenv was extremly old - 1.1
After pip upgrade, everything worked, in case someone has same issue as I did.

I have the same issue in OSX.

Same issue here with ubuntu. 12.04, upgrading system packages fixed it:

$ sudo pip install -U requests
$ sudo pip install -U pip

EDIT : Issue still there in deed... investigating

EDIT : ok, a complete requests uninstall and install back via pip fixed the issue.

i have the same issue on Fedora 19 ,after yum install openssl-devel fixed this issue and work well

On OSX, upgrading open ssl and reinstalling python fixed this. The steps were:

brew install openssl
brew unlink python
brew install python

worked.

As @bwest87 suggested, installing/upgrading openssl worked. Thanks

I got the same error today. installing opessl-devel and recompiling python did solve the get-pip issue. Further investigation pointed that the get-pip.py is trying to extract certificate to pass at --cert argument.

    # We need to extract the SSL certificates from requests so that they
    # can be passed to --cert
    cert_path = os.path.join(tmpdir, "cacert.pem")
    with open(cert_path, "wb") as cert:
        cert.write(pkgutil.get_data("pip._vendor.requests", "cacert.pem"))

I encountered the same error. But I found out that I had forgotten to add sudo ...

Has anyone comes up with a method to solve this problem on OSX especially on el captain?
It's killing me right now.

afair on el captaion it is a massive bug in the platform python - does it happen in a homebrew python?

I was having this issue since yesterday. When I ran pip I got the error: ImportError: No module named 'pip._vendor.requests'. Here's how I fixed mine:
When I ran brew install python, I got the error: could not delete '/usr/local/lib/python2.7/site-packages/pip/__init__.py': Permission denied. So I found out that my ../pip/ dir was owned by root, so I ran sudo chown -R {user} ./pip/ and then ran brew reinstall python which did not give any errors and now pip works fine.

Closing this, I cannot reproduce it. In addition it appears that this is an issue with the ssl module or similar on some platforms and isn't a pip issue. If you're getting this try to run python -c "import ssl" and see if that fails, if it does then you need to fix your Python installation.

Can anyone help here.
I am trying to install keras in conda using pip and I get below error:

(C:UsersHARSHALLAnaconda3) C:UsersHARSHALL>pip install --upgrade keras
Traceback (most recent call last):
File "C:UsersHARSHALLAnaconda3Scriptspip-script.py", line 6, in
from pip import main
File "C:UsersHARSHALLAnaconda3libsite-packagespip_init_.py", line 28, in
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "C:UsersHARSHALLAnaconda3libsite-packagespipvcsmercurial.py", line 9, in
from pip.download import path_to_url
File "C:UsersHARSHALLAnaconda3libsite-packagespipdownload.py", line 41, in
from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
ImportError: No module named 'pip._vendor.requests.adapters'

@hlamba28 - See here. msarahan's solution fixed it for me. https://github.com/ContinuumIO/anaconda-issues/issues/6317

Easy fix for windows users:

easy_install requests

just go to here :https://www.lfd.uci.edu/~gohlke/pythonlibs/ ,download the pipenv

review your code锛宮ay is cause of this code

from pip._vendor import requests

This could be caused by using "sudo pip" which is not supposed to be used in general. The solution that worked for me on Arch Linux is:

sudo rm -rf /usr/lib/python3.6/site-packages/pip /usr/lib/python3.6/site-packages/pkg_resources
sudo pacman -S python-setuptools python-pip

Source:
https://bbs.archlinux.org/viewtopic.php?id=237451

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings