Reputation: 89
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
Upvotes: 9
Views: 63685
Reputation: 11
I encountered the problem when installing 3.8.11. I tried the above posts but they didn't work.
This is how I finally made it compile:
1) Install openssl 1.1.1g;
2) untar the tarball;
3) enter the source directory;
4) run ./config --prefix=/usr/local/openssl_1.1 --openssldir=/usr/local/openssl_1.1
to install to /usr/local/openssl_1.1.
make & make install.
You can customize the directory.
5)Download python 3.8 source tarball;
6)untar the tarball. Enter the source/Modules;
7) edit the file Setup;
8) find the lines:
SSL=/usr/local/ssl
ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
change SSL=/usr/local/ssl to SSL=/usr/local/openssl_1.1
9) Switch to the source directory. run
./configure --prefix=/usr/local/python3.8 --with-openssl=/usr/local/openssl_1.1
10) export LD_LIBRARY_PATH=/usr/local/openssl_1.1/lib:$LD_LIBRARY_PATH
11) make & make install. If you need sudo, also export LD_LIBRARY_PATH in sudo
Upvotes: 1
Reputation: 11
This command worked very well for me.
cd Python-3.6.2
./configure --with-ssl
make
sudo make install
Upvotes: 0
Reputation: 145
Running ./configure
with --enable-optimizations
did the trick.
Here are the steps that worked for me on a Ubuntu 16.04 LTS box-
The lines related to ssl
in the Modules/Setup*
files are commented
cd to the directory where you have the Python tar extracted
cd /../../../Python-3.7.4/
Run configure with optimizations enabled
./configure --enable-optimizations
Run make and then make install
make
make install
Upvotes: 4
Reputation: 339
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.
Upvotes: 1
Reputation: 19
I encountered the same problem in Windows 10.
What I did was:
Step 1: go to https://pypi.python.org/simple/requests and download the latest version (e.g., requests-2.21.0.tar.gz).
Step 2: unzip the downloaded file into a folder (e.g., c:\temp\requests-2.21.0). You can use 7zip for that purpose.
Step 3: pip install c:\temp\requests-2.21.0
Note: pip can also install a local folder.
It worked for me.
Upvotes: -1
Reputation: 1210
I use Linux distros and face the problem since the new installation of Python 3.6. I tried a couple of solution and finally solved the problem. The steps I followed are as below.
On Debian like distros
sudo apt-get install build-essential checkinstall libreadline-gplv2-dev ibncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Change the directory to the Python3.6 location
cd /path/to/Python3.6/Module/
In the module directory, open the Setup
file with your preferred text editor
vi Setup
Search for SSL
and uncomment the related lines.
ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
Save the file and on the root folder of your Python package, run the following command.
make
sudo make install
And finally, run the pip3
to install your required module(s).
Upvotes: 10