Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"ssl module in Python is not available"

Tags:

python

pip

still advancing in my tutorial to learn python, I was told to do

sudo -H pip install requests

I get the following :

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Could not fetch URL https://pypi.python.org/simple/requests/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests

would someone know what I need to do to fix that once for all ?

thanks so much in advance

like image 567
gRookie Avatar asked Mar 04 '18 11:03

gRookie


People also ask

Can't connect to https because the SSL module is not available PIP?

This is likely due to libssl being installed, then your python virtualenv env created, then something happening to libssl, such as being upgraded/removed. The first step to resolve is to ensure you have libssl installed. If you're not using pyenv, then however you installed Python remove it and reinstall.

What is SSL package in python?

Source code: Lib/ssl.py. This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library.

How do I install pip?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process. Voila!


2 Answers

Running ./configure with --enable-optimizations did the trick.

Here are the steps that worked for me on a Ubuntu 16.04 LTS box-

  1. The lines related to ssl in the Modules/Setup* files are commented

  2. cd to the directory where you have the Python tar extracted

    cd /../../../Python-3.7.4/

  3. Run configure with optimizations enabled

    ./configure --enable-optimizations

  4. Run make and then make install

    make

    make install

like image 101
Arunraj Nair Avatar answered Oct 13 '22 23:10

Arunraj Nair


I encountered this problem running pip on Powershell on Windows, using the Anaconda distribution. I was running it inside VSCode, but I don't think it makes much difference.

A quick turnaround for me was installing what I needed using the Anaconda prompt, which works fine.

like image 21
Eric Grinstein Avatar answered Oct 13 '22 23:10

Eric Grinstein