I've install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3
.
When I execute pip3 install <package>
, I get the following SSL related error:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting <package>
Could not fetch URL https://pypi.python.org/simple/<package>/: 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 <package> (from versions: )
No matching distribution found for <package>
How can I fix my Python3.x install so that I can install packages with pip install <package>
?
I was having the same issue and was able to resolve with the following steps:
depending on perms, you may not need sudo.
should now be able to run
and
When installing packages:
or depending on perms, you can also add the --user flag like so:
I had the same issue trying to install python3.7 on an ubuntu14.04 machine. The issue was that I had some custom folders in my PKG_CONFIG_PATH and in my LD_LIBRARY_PATH, which prevented the python build process to find the system openssl libraries.
so try to clear them and see what happens:
The python documentation is actually very clear, and following the instructions did the job whereas other answers I found here were not fixing this issue.
first, install python 3.x.x from source using, for example with version 3.6.2 https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
make sure you have openssl installed by running
brew install openssl
unzip it and move to the python directory:
tar xvzf Python-3.6.2.tar.xz && cd Python-3.6.2
then if the python version is < 3.7, run
CPPFLAGS="-I$(brew --prefix openssl)/include" \ LDFLAGS="-L$(brew --prefix openssl)/lib" \ ./configure --with-pydebug
5. finallly, runmake -s -j2
(-s
is the silent flag,-j2
tells your machine to use 2 jobs)If you are on Red Hat/CentOS:
Step by step guide to install Python 3.6 and pip3 in Ubuntu
Download Python-3.6.1.tar.xz from https://www.python.org/
Unzip the file and keep the folder in home directory.
Open terminal in that directory and perform the following commands:
./configure make make test sudo make install
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Now write the following to re run the installation:
sudo make sudo make install
Now you can install packages with
Python 3.6
using pip3 command. For example:sudo pip3 install numpy
If you are on OSX and have compiled python from source:
Install openssl using brew
brew install openssl
Make sure to follow the instructions brew gives you about setting your
CPPFLAGS
andLDFLAGS
. In my case I am using theopenssl@1.1
brew formula and I need these 3 settings for the python build process to correctly link to my SSL library:Assuming the library is installed at that location.