ImportError: cannot import name HTTPSHandler installing get-pip.py

12,553

Solution 1

You have a Python without SSL support compiled. Unfortunately, get-pip appears to require SSL support.

If you are using a Linux distribution, make sure OpenSSL is installed, including the headers when compiling Python from source.

Solution 2

So looks like i was missing the openssl-devel dependency after I had installed that, i was able to install this.

Solution 3

I have meet the same problem. I solved it by install openssl-devel and reconfigure, make, make install python3:

yum install openssl-devel

then go to the python3 directory:

./configure --with-zlib --with-openssl

make

make install

Solution 4

I was having this issue on a Centos 6.5 machine even though I had openssl and openssl-devel installed. I was also using the steps from the site: http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/

I removed python packages I had installed before: virtualenv, NetworkX, and pil:

pip uninstall virtualenv
pip uninstall NetworkX
pip uninstall pil

Then I compiled Python 2.7 again and no longer had this issue. After I followed the steps in the link below, I reinstalled the above packages using pip2.7:

pip2.7 install virtualenv
pip2.7 install NetworkX
pip2.7 install pil --allow-external pil --allow-unverified pil
Share:
12,553
Shiro
Author by

Shiro

Updated on July 10, 2022

Comments

  • Shiro
    Shiro almost 2 years

    I'm getting this error when I try to install pip2.7. I have python 2.7 as my default already, but I'm not sure why I'm getting this.

    OS: CentOS 6.5

    OpenSSL has been installed already. I followed this guide to install Python 2.7: http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/

    [root@myservername arandomfolder]# python get-pip.py
    Traceback (most recent call last):
      File "get-pip.py", line 17474, in <module>
        main()
      File "get-pip.py", line 17466, in main
        bootstrap(tmpdir=tmpdir)
      File "get-pip.py", line 17406, in bootstrap
        import pip
      File "/tmp/tmpXq2wUP/pip.zip/pip/__init__.py", line 10, in <module>
      File "/tmp/tmpXq2wUP/pip.zip/pip/util.py", line 18, in <module>
      File "/tmp/tmpXq2wUP/pip.zip/pip/_vendor/distlib/version.py", line 14, in <module>
      File "/tmp/tmpXq2wUP/pip.zip/pip/_vendor/distlib/compat.py", line 31, in <module>
    ImportError: cannot import name HTTPSHandler
    
  • Padraic Cunningham
    Padraic Cunningham almost 10 years
    I was going to give the same answer but was waiting to actually find out what os the OP is using.
  • Martijn Pieters
    Martijn Pieters almost 10 years
    @PadraicCunningham: Not Windows, obviously. Mac OS X comes with a Python that includes OpenSSL support, and compiling one will pick up the headers properly. So it is either a BSD or a Linux distro.
  • Padraic Cunningham
    Padraic Cunningham almost 10 years
    I understand that but there are different packages for different linux distributions.
  • Martijn Pieters
    Martijn Pieters almost 10 years
    @PadraicCunningham: sure, and if and when the OP asks for help with that we can add that info.
  • Shiro
    Shiro almost 10 years
    @PadraicCunningham I'm using Centos 6.5 I have installed Python 2.7 and it also comes with Python2.6 pre-installed I have installed OpenSSL as well.
  • xxks-kkk
    xxks-kkk about 8 years
    @Shiro You need to recompile python from source and reinstall the python again.