Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTPSHandler error while installing pip with python 2.7.9

Hi I am trying to install pip with python 2.7.9 but keep getting following error. I want to create python virtual env.

 python get-pip.py

        Traceback (most recent call last):
          File "get-pip.py", line 17767, in <module>
            main()
          File "get-pip.py", line 162, in main
            bootstrap(tmpdir=tmpdir)
          File "get-pip.py", line 82, in bootstrap
            import pip
          File "/tmp/tmp_Tfw2V/pip.zip/pip/__init__.py", line 15, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/vcs/subversion.py", line 9, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/index.py", line 30, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/wheel.py", line 35, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/_vendor/distlib/scripts.py", line 14, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/_vendor/distlib/compat.py", line 31, in <module>

   ImportError: cannot import name HTTPSHandler

I guess this is something related to openssl libraries. Since i don't have sudo access I would like to install it in home folder from source. Any idea how to do it?

like image 521
R Dha Avatar asked Aug 17 '15 15:08

R Dha


People also ask

Why is pip install not working in Python?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

Does pip work with Python2?

Fix environment issues It is possible that you are trying to use the wrong version of pip. For example, pip3 works for Python3 , whereas pip works only for Python2 .

Does Python 2.7 5 have pip?

pip no longer supports Python 2.7. 5. You need to upgrade to a newer version of Python (2.7.


1 Answers

Make sure you have openssl and openssl-devel installed before you build Python 2.7

 yum install openssl openssl-devel

or

apt-get install openssl openssl-devel

or (for Debian):

apt-get install libssl-dev

To rebuild Python

cd ~
wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar xzf Python-2.7.9.tgz
cd Python-2.7.9
./configure
make install

Then the python get-pip.py should work.

like image 53
Paul Phillips Avatar answered Oct 16 '22 00:10

Paul Phillips