0

I am using Ubuntu 18.04 and it had python 3.6.5 by default.
I wanted python 3.5.2 for a project so I downloaded it alongside python3.6, but now the problem is I can't download pip for python 3.5.2 .
It shows this error when I try to download it using

python3.5 -m ensurepip --default-pip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS

and when I try to install it using get-pip.py, it shows error

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

How do I fix this issue?

I have working pip installed for python3.6 an need a pip for python 3.5.2 .

1

Per your error message, I think you just need to install python-openssl:

sudo apt install python-openssl

If the above does not work, you might be able to install for 3.5 via the python shell:

$ python3.5

And then from the python shell:

import ssl

If that doesn't work, you need to recompile python 3.5 with ssl support. Start by installing openssl:

sudo apt install openssl openssl-dev

Then inside your source directory, you need to enable ssl by editing Modules/Setup.dist:

nano Modules/Setup.dist

Search (ctrl+w) for ssl and uncomment (remove #) from the following line:

#SSL=/usr/local/ssl

It will look like this when you are done:

_socket socketmodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto

Then you can just compile and install:

$ ./configure
$ make
$ sudo make install
  • I installed openssl but I am still getting the same error when installing pip for python 3.5.2. – Belal Sep 21 '18 at 17:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.