Related
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>?
Step by step guide to install Python 3.6 and pip3 in Ubuntu
Install the necessary packages for Python and ssl: $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Download and unzip "Python-3.6.8.tar.xz" from https://www.python.org/ftp/python/ into your home directory.
Open terminal in that directory and run: $ ./configure
Build and install: $ make && sudo make install
Install packages with: $ pip3 install package_name
Disclaimer: The above commands are not tested in Ubuntu 20.04 LTS.
If you are on Windows and use anaconda this worked for me:
I tried a lot of other solutions which did not work (Environment PATH Variable changes ...)
The problem can be caused by DLLs in the Windows\System32 folder (e.g. libcrypto-1_1-x64.dll or libssl-1_1-x64.dll or others) placed there by other software.
The fix was installing openSSL from https://slproweb.com/products/Win32OpenSSL.html which replaces the dlls by more recent versions.
If you are on Red Hat/CentOS:
# To allow for building python ssl libs
yum install openssl-devel
# Download the source of *any* python version
cd /usr/src
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar xf Python-3.6.2.tar.xz
cd Python-3.6.2
# Configure the build w/ your installed libraries
./configure
# Install into /usr/local/bin/python3.6, don't overwrite global python bin
make altinstall
I had a similar problem on OSX 10.11 due to installing memcached which installed python 3.7 on top of 3.6.
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Spent hours on unlinking openssl, reinstalling, changing paths.. and nothing helped. Changing openssl version back from to older version did the trick:
brew switch openssl 1.0.2e
I did not see this suggestion anywhere in internet. Hope it serves someone.
In Ubuntu, this can help:
cd Python-3.6.2
./configure --with-ssl
make
sudo make install
Agree with the answer by mastaBlasta. Worked for me. I encountered the same problem as the topic description.
Environment: MacOS Sierra. And I use Homebrew.
My solution:
Reinstall openssl by brew uninstall openssl; brew install openssl
According to the hints given by Homebrew, do the following:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
I had the same issue with python3.8.5 installation on Debian9. I have done a build, but when I have tried to download some modules, pip3.8 issued following error:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
I have searched for the root of my problem and found out that there is a system dependent portion of the python build which is called by system independent one. In case of missing ssl you just needed to open python terminal and check whether is _ssl present:
>>> help('modules')
.
.
_sre enum pwd wave
_ssl errno py_compile weakref
_stat faulthandler pyclbr webbrowser
.
.
If not your system dependent ssl module part is missing. You can check it also by listing content of <python_installation_root>/lib/python3.8/lib-dynload:
>ls ./lib/python3.8/lib-dynload | grep ssl
_ssl.cpython-38-x86_64-linux-gnu.so
The problem was caused as written by PengShaw by missing libssl-dev during the build. Therefore you have to follow the recommended python installation flow. First install prerequisites and then build and install the python. Installation without devel versions of libs resulted in my case in the missing system dependent part. In this case _ssl.
Note that the devel lib name differs for Debian and CentOS, therefore check whether the installation hints posted on net are suitable for your specific Linux system type:
For Debian:
sudo apt install -y libbz2-dev libffi-dev libssl-dev
./configure --enable-optimizations
make
make altinstall
For CentOS:
sudo yum -y install bzip2-devel libffi-devel openssl-devel
./configure --enable-optimizations
make
make altinstall
It is for sure a good idea to list configuration options prior the configuration and evtl. use some additional options:
./configure --help
Last but not least in case you use --prefix for a non-default installation location, remember to add your <python_installation_root>/lib to your LD_LIBRARY_PATH .
If you are on Windows and use Anaconda you can try running "pip install ..." command in Anaconda Prompt instead of cmd.exe, as user willliu1995 suggests here. This was the fastest solution for me, that does not require installation of additional components.
The problem probably caused by library missing.
Before you install python 3.6, make sure you install all the libraries required for python.
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
More information in How to Install Python 3.6.0 on Ubuntu & LinuxMint
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 and LDFLAGS. In my case I am using the openssl#1.1 brew formula and I need these 3 settings for the python build process to correctly link to my SSL library:
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig"
Assuming the library is installed at that location.
Downgrading openssl worked for me,
brew switch openssl 1.0.2s
I encountered the same problem on windows 10. My very specific issue is due to my installation of Anaconda. I installed Anaconda and under the path Path/to/Anaconda3/, there comes the python.exe. Thus, I didn't install python at all because Anaconda includes python. When using pip to install packages, I found the same error report, pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available..
The solution was the following:
1) you can download python again on the official website;
2) Navigate to the directory where "Python 3.7 (64-bit).lnk"is located
3) import ssl and exit()
4) type in cmd, "Python 3.7 (64-bit).lnk" -m pip install tensorflow for instance.
Here, you're all set.
I tried A LOT of ways to solve this problem and none solved. I'm currently on Windows 10.
The only thing that worked was:
Uninstall Anaconda
Uninstall Python (i was using version 3.7.3)
Install Python again (remember to check the option to automatically add to PATH)
Then I've downloaded all the libs I needed using PIP... and worked!
Don't know why, or if the problem was somehow related to Anaconda.
for osx brew users
my issue appeared related to my python installation and was quickly resolved by re-installing python3 and pip. i think it started misbehaving after an OS update but who knows (at this time I am on Mac OS 10.14.6)
brew reinstall python3 --force
# setup pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
# installa pkg successfully
pip install pandas
You can do either of these two:
While installing Anaconda, select the option to add Anaconda to the path.
or
Find these (complete) paths from your installation folder of Anaconda and add them to the environment variable :
\Anaconda
\Anaconda\Library\mingw-w64\bin
\Anaconda\Library\usr\bin
\Anaconda\Library\bin
\Anaconda\Scripts
\anaconda\Library
\anaconda\condabin
Add the above paths to the "Path" system variable and it should show the error no more :)
The ssl module is a TLS/SSL wrapper for accessing Operation Sytem (OS) socket (Lib/ssl.py). So when ssl module is not available, chances are that you either don't have OS OpenSSL libraries installed, or those libraries were not found when you install Python. Let assume it is a later case (aka: you already have OpenSSL installed, but they are not correctly linked when installing Python).
I will also assume you are installing from source. If you are installing from binary (ie: Window .exe file), or package (Mac .dmg, or Ubuntu apt), there is not much you can do with the installing process.
During the step of configuring your python installation, you need to specify where the OS OpenSSL will be used for linking:
# python 3.8 beta
./configure --with-openssl="your_OpenSSL root"
So where will you find your installed OpenSSL directory?
# ubuntu
locate ssl.h | grep '/openssl/ssl.h'
/home/user/.linuxbrew/Cellar/openssl/1.0.2r/include/openssl/ssl.h
/home/user/envs/py37/include/openssl/ssl.h
/home/user/miniconda3/envs/py38b3/include/openssl/ssl.h
/home/user/miniconda3/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.0.2s-h7b6447c_0/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.1.1b-h7b6447c_1/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.1.1c-h7b6447c_1/include/openssl/ssl.h
/usr/include/openssl/ssl.h
Your system may be different than mine, but as you see here I have many different installed openssl libraries. As the time of this writing, python 3.8 expects openssl 1.0.2 or 1.1:
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
So you would need to verify which of those installed libraries that you can use for linking, for example
/usr/bin/openssl version
OpenSSL 1.0.2g 1 Mar 2016
./configure --with-openssl="/usr"
make && make install
You may need to try a few, or install a new, to find the library that would work for your Python and your OS.
I was having the same issue and was able to resolve with the following steps:
sudo yum install -y libffi-devel
sudo yum install openssl-devel
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
sudo tar xf Python-3.7.1.tar.xz
cd Python-3.7.1
sudo ./configure --enable-optimizations
# Install into /usr/local/bin/python3.7, don't overwrite global python bin
sudo make altinstall
depending on perms, you may not need sudo.
Results:
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1
should now be able to run
python3.7 -V
and
pip3.7 -V
When installing packages:
pip3.7 install pandas
or depending on perms, you can also add the --user flag like so:
pip3.7 install pandas --user
In my case with using Mac, I deleted
/Applications/Python 3.7.
because I already had Python3.7 by brew install python3 .
But it was a trigger of the message
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
What I did in my situation
I downloaded macOS 64-bit installer again, and installed.
Double click /Applications/Python3.6/Install Certificates.command and /Applications/Python3.6/Update Shell Profile.command.
Reboot mac
And I am not sure but possibly contributed to succeed is pip.conf. See pip install fails.
I finally solve this issue. These are the detail of my env:
Version of Python to install: 3.6.8
OS: Ubuntu 16.04.6 LTS
Root access: No
Some people suggest to install libssl-dev, but it did not work for me. I follow this link and I fixed it!
In short, I download, extract, build, and install OpenSSL (openssl-1.1.1b.tar.gz). Then, I modify .bashrc file follow this link.
Next, I download and extract Python-3.6.8.tgz. I edit Modules/Setup.dist to modify SSL path (lines around #211). I did ./configure --prefix=$HOME/opt/python-3.6.8, make and make install. Last, I modify my .bashrc. Notice that I do not include --enable-optimizations in ./configure.
I was able to fix this by updating the python version in this file.
pyenv: version `3.6.5' is not installed (set by /Users/taruntarun/.python-version)
Though i had the latest version installed, my command was still using old version 3.6.5
Moving to version 3.7.3
Termux
This worked because i didnt have an existing openssl version installed.
pkg install openssl-tool
If you are on OSX and in case the other solutions didn't work for you (just like me).
You can try uninstalling python3 and upgrade pip3
brew uninstall --ignore-dependencies python3
pip3 install --upgrade pip
This worked for me ;)
(NOT on Windows!)
This made me tear my hair out for a week, so I hope this will help someone
I tried everything short of re-installing Anaconda and/or Jupyter.
Setup
AWS Linux
Manually installed Anaconda 3-5.3.0
Python3 (3.7) was running inside anaconda (ie, ./anaconda3/bin/python)
there was also /usr/bin/python and /usr/bin/python3 (but these were not being used as most of the work was done in Jupyter's terminal)
Fix
In Jupyter's terminal:
cp /usr/lib64/libssl.so.10 ./anaconda3/lib/libssl.so.1.0.0
cp /usr/lib64/libcrypto.so.10 ./anaconda3/lib/libcrypto.so.1.0.0
What triggered this?
So, this was all working until I tried to do a conda install conda-forge
I'm not sure what happened, but conda must have updated openssl on the box (I'm guessing) so after this, everything broke.
Basically, unknown to me, conda had updated openssl, but somehow deleted the old libraries and replaced it with libssl.so.1.1 and libcrypto.so.1.1.
Python3, I guess, was compiled to look for libssl.so.1.0.0
In the end, the key to diagnosis was this:
python -c "import ssl; print (ssl.OPENSSL_VERSION)"
gave the clue library "libssl.so.1.0.0" not found
The huge assumption I made is that the yum version of ssl is the same as the conda version, so just renaming the shared object might work, and it did.
My other solution was to re-compile python, re-install anaconda, etc, but in the end I'm glad I didn't need to.
Hope this helps you guys out.
In the case of using pyenv to manage python installations on Mac OS Catalina, I had to install openssl with brew first and then after that run pyenv install 3.7.8 which seemed to build the python installation using the openssl from homebrew (it even said as such in the installation output). Then pyenv global 3.7.8 and I was away.
On macos, configure python 3.8.1 with the command below will solve the problem, i think it would also work on Linux.
./configure --enable-optimizations --with-openssl=/usr/local/opt/openssl#1.1/
change the dir parameter based on your system.
I've made some PATH changes to mimic part of the Anaconda Powershell Prompt $env:PATH
C:\Users\merheb\Miniconda3;C:\Users\merheb\Miniconda3\Library\mingw-w64\bin;C:\Users\merheb\Miniconda3\Library\usr\bin;C:\Users\merheb\Miniconda3\Library\bin;C:\Users\merheb\Miniconda3\Scripts;C:\Users\merheb\Miniconda3\bin;C:\Users\merheb\Miniconda3\condabin;
And It worked for me.
Building from source was what worked for me on Ubuntu 22.10:
Install OpenSSL manually, tested here with OpenSSL 1.1.1s, extracted then ran:
./config --prefix='/opt/openssl' --openssldir='/opt/ssl'
make
make install
Then with your older Python 3 version (here Python-3.8.16) run:
export LD_RUN_PATH='/opt/openssl/lib'
export CC='gcc-12' # sudo apt install gcc-12
./configure --enable-optimizations \
--with-openssl='/opt/openssl' \
--prefix='/opt/python/3.8' -C
make
make install
Test with:
/opt/python/3.8/bin/python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.1.1s 1 Nov 2022
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, run make -s -j2 (-s is the silent flag, -j2 tells your machine to use 2 jobs)
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:
export PKG_CONFIG_PATH=""
export LD_LIBRARY_PATH=""
Ok the latest answer to this, as of now don't use Python 3.8, use only 3.7 or less , because of most of the libraries fail to install with the above error
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>?
Step by step guide to install Python 3.6 and pip3 in Ubuntu
Install the necessary packages for Python and ssl: $ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Download and unzip "Python-3.6.8.tar.xz" from https://www.python.org/ftp/python/ into your home directory.
Open terminal in that directory and run: $ ./configure
Build and install: $ make && sudo make install
Install packages with: $ pip3 install package_name
Disclaimer: The above commands are not tested in Ubuntu 20.04 LTS.
If you are on Windows and use anaconda this worked for me:
I tried a lot of other solutions which did not work (Environment PATH Variable changes ...)
The problem can be caused by DLLs in the Windows\System32 folder (e.g. libcrypto-1_1-x64.dll or libssl-1_1-x64.dll or others) placed there by other software.
The fix was installing openSSL from https://slproweb.com/products/Win32OpenSSL.html which replaces the dlls by more recent versions.
If you are on Red Hat/CentOS:
# To allow for building python ssl libs
yum install openssl-devel
# Download the source of *any* python version
cd /usr/src
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar xf Python-3.6.2.tar.xz
cd Python-3.6.2
# Configure the build w/ your installed libraries
./configure
# Install into /usr/local/bin/python3.6, don't overwrite global python bin
make altinstall
I had a similar problem on OSX 10.11 due to installing memcached which installed python 3.7 on top of 3.6.
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Spent hours on unlinking openssl, reinstalling, changing paths.. and nothing helped. Changing openssl version back from to older version did the trick:
brew switch openssl 1.0.2e
I did not see this suggestion anywhere in internet. Hope it serves someone.
In Ubuntu, this can help:
cd Python-3.6.2
./configure --with-ssl
make
sudo make install
Agree with the answer by mastaBlasta. Worked for me. I encountered the same problem as the topic description.
Environment: MacOS Sierra. And I use Homebrew.
My solution:
Reinstall openssl by brew uninstall openssl; brew install openssl
According to the hints given by Homebrew, do the following:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
I had the same issue with python3.8.5 installation on Debian9. I have done a build, but when I have tried to download some modules, pip3.8 issued following error:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
I have searched for the root of my problem and found out that there is a system dependent portion of the python build which is called by system independent one. In case of missing ssl you just needed to open python terminal and check whether is _ssl present:
>>> help('modules')
.
.
_sre enum pwd wave
_ssl errno py_compile weakref
_stat faulthandler pyclbr webbrowser
.
.
If not your system dependent ssl module part is missing. You can check it also by listing content of <python_installation_root>/lib/python3.8/lib-dynload:
>ls ./lib/python3.8/lib-dynload | grep ssl
_ssl.cpython-38-x86_64-linux-gnu.so
The problem was caused as written by PengShaw by missing libssl-dev during the build. Therefore you have to follow the recommended python installation flow. First install prerequisites and then build and install the python. Installation without devel versions of libs resulted in my case in the missing system dependent part. In this case _ssl.
Note that the devel lib name differs for Debian and CentOS, therefore check whether the installation hints posted on net are suitable for your specific Linux system type:
For Debian:
sudo apt install -y libbz2-dev libffi-dev libssl-dev
./configure --enable-optimizations
make
make altinstall
For CentOS:
sudo yum -y install bzip2-devel libffi-devel openssl-devel
./configure --enable-optimizations
make
make altinstall
It is for sure a good idea to list configuration options prior the configuration and evtl. use some additional options:
./configure --help
Last but not least in case you use --prefix for a non-default installation location, remember to add your <python_installation_root>/lib to your LD_LIBRARY_PATH .
If you are on Windows and use Anaconda you can try running "pip install ..." command in Anaconda Prompt instead of cmd.exe, as user willliu1995 suggests here. This was the fastest solution for me, that does not require installation of additional components.
The problem probably caused by library missing.
Before you install python 3.6, make sure you install all the libraries required for python.
$ sudo apt-get install build-essential checkinstall
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
More information in How to Install Python 3.6.0 on Ubuntu & LinuxMint
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 and LDFLAGS. In my case I am using the openssl#1.1 brew formula and I need these 3 settings for the python build process to correctly link to my SSL library:
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl#1.1/lib/pkgconfig"
Assuming the library is installed at that location.
Downgrading openssl worked for me,
brew switch openssl 1.0.2s
I encountered the same problem on windows 10. My very specific issue is due to my installation of Anaconda. I installed Anaconda and under the path Path/to/Anaconda3/, there comes the python.exe. Thus, I didn't install python at all because Anaconda includes python. When using pip to install packages, I found the same error report, pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available..
The solution was the following:
1) you can download python again on the official website;
2) Navigate to the directory where "Python 3.7 (64-bit).lnk"is located
3) import ssl and exit()
4) type in cmd, "Python 3.7 (64-bit).lnk" -m pip install tensorflow for instance.
Here, you're all set.
I tried A LOT of ways to solve this problem and none solved. I'm currently on Windows 10.
The only thing that worked was:
Uninstall Anaconda
Uninstall Python (i was using version 3.7.3)
Install Python again (remember to check the option to automatically add to PATH)
Then I've downloaded all the libs I needed using PIP... and worked!
Don't know why, or if the problem was somehow related to Anaconda.
for osx brew users
my issue appeared related to my python installation and was quickly resolved by re-installing python3 and pip. i think it started misbehaving after an OS update but who knows (at this time I am on Mac OS 10.14.6)
brew reinstall python3 --force
# setup pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
# installa pkg successfully
pip install pandas
You can do either of these two:
While installing Anaconda, select the option to add Anaconda to the path.
or
Find these (complete) paths from your installation folder of Anaconda and add them to the environment variable :
\Anaconda
\Anaconda\Library\mingw-w64\bin
\Anaconda\Library\usr\bin
\Anaconda\Library\bin
\Anaconda\Scripts
\anaconda\Library
\anaconda\condabin
Add the above paths to the "Path" system variable and it should show the error no more :)
The ssl module is a TLS/SSL wrapper for accessing Operation Sytem (OS) socket (Lib/ssl.py). So when ssl module is not available, chances are that you either don't have OS OpenSSL libraries installed, or those libraries were not found when you install Python. Let assume it is a later case (aka: you already have OpenSSL installed, but they are not correctly linked when installing Python).
I will also assume you are installing from source. If you are installing from binary (ie: Window .exe file), or package (Mac .dmg, or Ubuntu apt), there is not much you can do with the installing process.
During the step of configuring your python installation, you need to specify where the OS OpenSSL will be used for linking:
# python 3.8 beta
./configure --with-openssl="your_OpenSSL root"
So where will you find your installed OpenSSL directory?
# ubuntu
locate ssl.h | grep '/openssl/ssl.h'
/home/user/.linuxbrew/Cellar/openssl/1.0.2r/include/openssl/ssl.h
/home/user/envs/py37/include/openssl/ssl.h
/home/user/miniconda3/envs/py38b3/include/openssl/ssl.h
/home/user/miniconda3/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.0.2s-h7b6447c_0/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.1.1b-h7b6447c_1/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.1.1c-h7b6447c_1/include/openssl/ssl.h
/usr/include/openssl/ssl.h
Your system may be different than mine, but as you see here I have many different installed openssl libraries. As the time of this writing, python 3.8 expects openssl 1.0.2 or 1.1:
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
So you would need to verify which of those installed libraries that you can use for linking, for example
/usr/bin/openssl version
OpenSSL 1.0.2g 1 Mar 2016
./configure --with-openssl="/usr"
make && make install
You may need to try a few, or install a new, to find the library that would work for your Python and your OS.
I was having the same issue and was able to resolve with the following steps:
sudo yum install -y libffi-devel
sudo yum install openssl-devel
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
sudo tar xf Python-3.7.1.tar.xz
cd Python-3.7.1
sudo ./configure --enable-optimizations
# Install into /usr/local/bin/python3.7, don't overwrite global python bin
sudo make altinstall
depending on perms, you may not need sudo.
Results:
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1
should now be able to run
python3.7 -V
and
pip3.7 -V
When installing packages:
pip3.7 install pandas
or depending on perms, you can also add the --user flag like so:
pip3.7 install pandas --user
In my case with using Mac, I deleted
/Applications/Python 3.7.
because I already had Python3.7 by brew install python3 .
But it was a trigger of the message
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
What I did in my situation
I downloaded macOS 64-bit installer again, and installed.
Double click /Applications/Python3.6/Install Certificates.command and /Applications/Python3.6/Update Shell Profile.command.
Reboot mac
And I am not sure but possibly contributed to succeed is pip.conf. See pip install fails.
I finally solve this issue. These are the detail of my env:
Version of Python to install: 3.6.8
OS: Ubuntu 16.04.6 LTS
Root access: No
Some people suggest to install libssl-dev, but it did not work for me. I follow this link and I fixed it!
In short, I download, extract, build, and install OpenSSL (openssl-1.1.1b.tar.gz). Then, I modify .bashrc file follow this link.
Next, I download and extract Python-3.6.8.tgz. I edit Modules/Setup.dist to modify SSL path (lines around #211). I did ./configure --prefix=$HOME/opt/python-3.6.8, make and make install. Last, I modify my .bashrc. Notice that I do not include --enable-optimizations in ./configure.
I was able to fix this by updating the python version in this file.
pyenv: version `3.6.5' is not installed (set by /Users/taruntarun/.python-version)
Though i had the latest version installed, my command was still using old version 3.6.5
Moving to version 3.7.3
Termux
This worked because i didnt have an existing openssl version installed.
pkg install openssl-tool
If you are on OSX and in case the other solutions didn't work for you (just like me).
You can try uninstalling python3 and upgrade pip3
brew uninstall --ignore-dependencies python3
pip3 install --upgrade pip
This worked for me ;)
(NOT on Windows!)
This made me tear my hair out for a week, so I hope this will help someone
I tried everything short of re-installing Anaconda and/or Jupyter.
Setup
AWS Linux
Manually installed Anaconda 3-5.3.0
Python3 (3.7) was running inside anaconda (ie, ./anaconda3/bin/python)
there was also /usr/bin/python and /usr/bin/python3 (but these were not being used as most of the work was done in Jupyter's terminal)
Fix
In Jupyter's terminal:
cp /usr/lib64/libssl.so.10 ./anaconda3/lib/libssl.so.1.0.0
cp /usr/lib64/libcrypto.so.10 ./anaconda3/lib/libcrypto.so.1.0.0
What triggered this?
So, this was all working until I tried to do a conda install conda-forge
I'm not sure what happened, but conda must have updated openssl on the box (I'm guessing) so after this, everything broke.
Basically, unknown to me, conda had updated openssl, but somehow deleted the old libraries and replaced it with libssl.so.1.1 and libcrypto.so.1.1.
Python3, I guess, was compiled to look for libssl.so.1.0.0
In the end, the key to diagnosis was this:
python -c "import ssl; print (ssl.OPENSSL_VERSION)"
gave the clue library "libssl.so.1.0.0" not found
The huge assumption I made is that the yum version of ssl is the same as the conda version, so just renaming the shared object might work, and it did.
My other solution was to re-compile python, re-install anaconda, etc, but in the end I'm glad I didn't need to.
Hope this helps you guys out.
In the case of using pyenv to manage python installations on Mac OS Catalina, I had to install openssl with brew first and then after that run pyenv install 3.7.8 which seemed to build the python installation using the openssl from homebrew (it even said as such in the installation output). Then pyenv global 3.7.8 and I was away.
On macos, configure python 3.8.1 with the command below will solve the problem, i think it would also work on Linux.
./configure --enable-optimizations --with-openssl=/usr/local/opt/openssl#1.1/
change the dir parameter based on your system.
I've made some PATH changes to mimic part of the Anaconda Powershell Prompt $env:PATH
C:\Users\merheb\Miniconda3;C:\Users\merheb\Miniconda3\Library\mingw-w64\bin;C:\Users\merheb\Miniconda3\Library\usr\bin;C:\Users\merheb\Miniconda3\Library\bin;C:\Users\merheb\Miniconda3\Scripts;C:\Users\merheb\Miniconda3\bin;C:\Users\merheb\Miniconda3\condabin;
And It worked for me.
Building from source was what worked for me on Ubuntu 22.10:
Install OpenSSL manually, tested here with OpenSSL 1.1.1s, extracted then ran:
./config --prefix='/opt/openssl' --openssldir='/opt/ssl'
make
make install
Then with your older Python 3 version (here Python-3.8.16) run:
export LD_RUN_PATH='/opt/openssl/lib'
export CC='gcc-12' # sudo apt install gcc-12
./configure --enable-optimizations \
--with-openssl='/opt/openssl' \
--prefix='/opt/python/3.8' -C
make
make install
Test with:
/opt/python/3.8/bin/python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)'
OpenSSL 1.1.1s 1 Nov 2022
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, run make -s -j2 (-s is the silent flag, -j2 tells your machine to use 2 jobs)
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:
export PKG_CONFIG_PATH=""
export LD_LIBRARY_PATH=""
Ok the latest answer to this, as of now don't use Python 3.8, use only 3.7 or less , because of most of the libraries fail to install with the above error
I'm trying to install some packages with pip.
But pip install unroll gives me
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\MARKAN~1\AppData\Local\Temp\pip-build-wa7uco0k\unroll\
How can I solve this?
About the error code
According to the Python documentation:
This module makes available standard errno system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are borrowed from linux/include/errno.h, which should be pretty all-inclusive.
Error code 1 is defined in errno.h and means Operation not permitted.
About your error
Your setuptools do not appear to be installed. Just follow the Installation Instructions from the PyPI website.
If it's already installed, try
pip install --upgrade setuptools
If it's already up to date, check that the module ez_setup is not missing. If it is, then
pip install ez_setup
Then try again
pip install unroll
If it's still not working, maybe pip didn't install/upgrade setup_tools properly so you might want to try
easy_install -U setuptools
And again
pip install unroll
Here's a little guide explaining a little bit how I usually install new packages on Python + Windows. It seems you're using Windows paths, so this answer will stick to that particular SO:
I never use a system-wide Python installation. I only use virtualenvs, and usually I try to have the latest version of 2.x & 3.x.
My first attempt is always doing pip install package_i_want in some of my Visual Studio command prompts. What Visual Studio command prompt? Well, ideally the Visual Studio which matches the one which was used to build Python. For instance, let's say your Python installation says Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32. The version of Visual Studio used to compile Python can be found here, so v1500 means I'd be using vs2008 x64 command prompt
If the previous step failed for some reason I just try using easy_install package_i_want
If the previous step failed for some reason I go to gohlke website and I check whether my package is available over there. If it's so, I'm lucky, I just download it into my virtualenv and then I just go to that location using a command prompt and I do pip install package_i_want.whl
If the previous step didn't succeed I'll just try to build the wheel myself and once it's generated I'll try to install it with pip install package_i_want.whl
Now, if we focus in your specific problem, where you're having a hard time installing the unroll package. It seems the fastest way to install it is doing something like this:
git clone https://github.com/Zulko/unroll
cd unroll && python setup.py bdist_wheel
Copy the generated unroll-0.1.0-py2-none-any.whl file from the created dist folder into your virtualenv.
pip install unroll-0.1.0-py2-none-any.whl
That way it will install without any problems. To check it really works, just login into the Python installation and try import unroll, it shouldn't complain.
One last note: This method works almost 99% of the time, and sometimes you'll find some pip packages which are specific to Unix or Mac OS X, in that case, when that happens I'm afraid the best way to get a Windows version is either posting some issues to the main developers or having some fun by yourself porting to Windows (typically a few hours if you're not lucky) :)
It was resolved after upgrading pip:
python -m pip install --upgrade pip
pip install "package-name"
I got stuck exactly with the same error with psycopg2. It looks like I skipped a few steps while installing Python and related packages.
sudo apt-get install python-dev libpq-dev
Go to your virtual env
pip install psycopg2
(In your case you need to replace psycopg2 with the package you have an issue with.)
It worked seamlessly.
I got this same error while installing mitmproxy using pip3. The below command fixed this:
pip3 install --upgrade setuptools
Download and install the Microsoft Visual C++ Compiler for Python 2.7 from https://www.microsoft.com/en-in/download/details.aspx?id=44266 - this package contains the compiler and set of system headers necessary for producing binary wheels for Python 2.7 packages.
Open a command prompt in elevated mode (run as administrator)
Firstly do pip install ez_setup
Then do pip install unroll (It will start installing numpy, music21, decorator, imageio, tqdm, moviepy, unroll) # Please be patient for music21 installation
Python 2.7.11 64 bit used
Other way:
sudo apt-get install python-psycopg2 python-mysqldb
I had the same issue when installing the "Twisted" library and solved it by running the following command on Ubuntu 16.04 (Xenial Xerus):
sudo apt-get install python-setuptools python-dev build-essential
It's a dependency issue.
I tried running the following commands helped me sorting out the dependencies, in my case the dependency was
grpcio
pip3 install --upgrade pip
python3 -m pip install --upgrade setuptools
pip3 install --no-cache-dir --force-reinstall -Iv grpcio==1.36.1
pip3 install pulsar-client==2.7.0
remember you must have python3 installed in your system.
First try:
pip install unroll
For sure not work :)
Then Try:
pip2 install unroll
Still get error Try:
pip3 install unroll
If pip3 Worked then suggest to change configuration to use pip3 as pip because you will get a lot of issues as the modern now is Python3 = pip3 if you execute a script files.
I had the same problem.
The problem was:
pyparsing 2.2 was already installed and my requirements.txt was trying to install pyparsing 2.0.1 which throw this error
Context: I was using virtualenv, and it seems the 2.2 came from my global OS Python site-packages, but even with --no-site-packages flag (now by default in last virtualenv) the 2.2 was still present. Surely because I installed Python from their website and it added Python libraries to my $PATH.
Maybe a pip install --ignore-installed would have worked.
Solution: as I needed to move forwards, I just removed the pyparsing==2.0.1 from my requirements.txt.
I ran into the same error code when trying to install a Python module with pip.
#Hackndo noted that the documentation indicate a security issue.
Based on that answer, my problem was solved by running the pip install command with sudo prefixed:
sudo pip install python-mpd2
For me this worked
python3 -m pip3 install -U pip
you can also try
python -m pip install -U pip
pip3 install --upgrade setuptools
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with -m pip instead of running pip directly.
Use python3 -m pip "command", eg:
python3 -m pip install --user pyqt5
I tried all of the above with no success. I then updated my Python version from 2.7.10 to 2.7.13, and it resolved the problems that I was experiencing.
That means some packages in pip are old or not correctly installed.
Try checking version and then upgrading pip.Use auto remove if that works.
If the pip command shows an error all the time for any command or it freezes, etc.
The best solution is to uninstall it or remove it completely.
Install a fresh pip and then update and upgrade your system.
I have given a solution to installing pip fresh here - python: can't open file get-pip.py error 2] no such file or directory
next installation helps me:
pip3 install cython
This worked for me:
sudo xcodebuild -license
Upgrading Python to version 3 fixed my problem. Nothing else did.
I downloaded the .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/ and then did:
pip install scipy-0.19.1-cp27-cp27m-win32.whl
Note that the version you need to use (win32/win_amd-64) depends on the version of Python and not that of Windows.
I had this problem using virtualenvs (with pipenv) on my new development setup.
I could only solve it by upgrading the psycopg2 version from 2.6.2 to 2.7.3.
More information is at https://github.com/psycopg/psycopg2/issues/594
I faced the same problem with the same error message but on Ubuntu 16.04 LTS (Xenial Xerus) instead:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-w71uo1rg/poster/
I tested all the solutions provided above and none of them worked for me. I read the full TraceBack and found out I had to create the virtual environment with Python version 2.7 instead (the default one uses Python 3.5 instead):
virtualenv --python=/usr/bin/python2.7 my_venv
Once I activated it, I run pip install unirest successfully.
try on linux:
sudo apt install python-pip python-bluez libbluetooth-dev libboost-python-dev libboost-thread-dev libglib2.0-dev bluez bluez-hcidump
Had the same problem on my Win10 PC with different packages and tried everything mentioned so far.
Finally solved it by disabling Comodo Auto-Containment.
Since nobody has mentioned it yet, I hope it helps someone.
I had the same problem and was able to fix by doing the following.
Windows Python needs Visual C++ libraries installed via the SDK to build code, such as via setuptools.extension.Extension or numpy.distutils.core.Extension. For example, building f2py modules in Windows with Python requires Visual C++ SDK as installed above. On Linux and Mac, the C++ libraries are installed with the compiler.
https://www.scivision.co/python-windows-visual-c++-14-required/
Following below command worked for me
[root#sandbox ~]# pip install google-api-python-client==1.6.4
Methods to solve setup.pu egg_info issue when updating setuptools or not other methods doesnot works.
If CONDA version of the library is available to install use conda instead of pip.
Clone the library repo and then try installation by pip install -e . or by python setup.py install
upgrading python's version did the work for me.
I have just encountered the same problem when trying to pip install -e . a new repo. I did not notice that the contents of setup.py haven't been saved properly and I was effectively running the command with an empty setup.py.
Hence you may experience the same error message if the setup.py of the target package is either empty or malformed.
I solved it on Centos 7 by using:
sudo yum install libcurl-devel
I was following the instructions here and I'm having trouble getting the installation to work. Basically, the first part works fine. I downloaded portaudio, followed the instructions, and it all seemed to work.
However, when I triedpython3 setup.py install, I got an error. The error came from the /src/_portaudiomodule.c file, and it said that "The file Python.h could not be found". I don't really understand what's going on because there was no Python.h file when I extracted the PyAudio archive. I don't know where the Python.h file was supposed to come from.
I'm kind of a noob to unix systems so I could have easily made a mistake somewhere. I've been trying to solve this for hours and I've had no luck so far. Thanks in advance for your help!
To install the latest version of pyaudio using conda:
source activate -your environment name-
pip install pyaudio
You may run into the following error when installing from pip:
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
compilation terminated.
error: command 'gcc' failed with exit status 1
That is because you don't have the PortAudio development package installed. Install it with:
sudo apt-get install portaudio19-dev
You don't need to compile pyaudio. To install PyAudio, run:
$ sudo add-apt-repository universe
$ sudo apt-get install python-pyaudio python3-pyaudio
The first command enables Universe Ubuntu repository.
If you want to compile it e.g., to use the latest version from git; install build dependencies:
$ sudo apt-get build-dep python-pyaudio python3-pyaudio
After that, you could install it from sources using pip:
$ python3 -mpip install pyaudio
Or to install the current version from git:
$ pip install -e git+http://people.csail.mit.edu/hubert/git/pyaudio.git#egg=pyaudio
Run pip commands inside a virtualenv or add --user command-line option, to avoid modifying the global python3 installation (leave it to the package manager).
I've tested it on Ubuntu. Let me know if it fails on Mint.
I have found the work arround for mac.
please refer the below steps to install pyaudio on python 3.5
Follow these steps :
export HOMEBREW_NO_ENV_FILTERING=1
xcode-select --install
brew update
brew upgrade
brew install portaudio
pip install pyaudio
I was able to get it install with anaconda, using this package.
Follow install instructions for linux here, then do:
conda install -c bokeh pyaudio=0.2.7
try to install using the the below command
pip install pyaudio
after that install the required Microsoft Visual C++ 14.0
refer the below image for the same.
and restart the system and run the same command again
pip install pyaudio
Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. To install this package, enter:
sudo apt-get install python3-dev
I installed python3.2 in ubuntu (the default edition is not deleted), and I follow the steps in here
However when i use
python3.2 setup.py install
I got:
"error: command 'gcc' failed with exit status 1",
"src/ft2font.cpp:2224:29: error: ‘Int’ is not a member of ‘Py’"
And when I use
sudo apt-get install python-matplotlib
I can use matplot in python2.x, while I still can not use it with python3.2
How can I install matplot in python3.2 ?
Matplotlib supports python 3.x as of version 1.2, released in January, 2013.
To install it, have a look at the installation instructions. In general, call pip install matplotlib or use your preferred mechanism (conda, homebrew, windows installer, system package manager, etc). In some cases you may need to install additional non-python dependencies (libpng and freetype) through your system's package manager.
The answer below is left for historical reasons and as an example of installing the development version from github.
The current release of matplotlib doesn't support python3.
There's a github branch for python3 support for a couple of years now, but it hasn't been stable on anything other than linux until fairly recently. I believe that branch was recently merged back into the main branch.
If you want to use matplotlib on python3, you'll need to build from the current tip https://github.com/matplotlib/matplotlib
To build it, do something similar to the following:
git clone https://github.com/matplotlib/matplotlib
cd matplotlib
python3 setup.py build
sudo python3 setup.py install
If you don't have git installed, then you can just download a tarball of the current git tip instead: https://github.com/matplotlib/matplotlib/tarball/master
You'll need to have numpy installed for python3. (Installing it for python2 doesn't install it for python3.)
In most cases, that's all you'll need to do. For a default install, the only non-included python library is numpy. The other dependencies (e.g. libpng, freetype) are system libraries and if you can build matplotlib for python2, you already have them.
If you want a non-default install (e.g. if you want any of the non-default backends), then you'll need to copy the setup.cfg.default template to setup.cfg and edit it to match what you want. You'll probably only need to do this if you're planning to embed matplotlib in a gtk or qt application that you're writing, in which case you'll want the gtkagg or qtagg backends instead of just the default tkagg backend.
just to bump #endolith's comment up to answer level, from at least uBuntu 14-04 linux onwards, matplotlib support for python3 is built-in with apt:
sudo apt-get install python3-matplotlib
should install matplotlib for python3 with the necessary dependencies.
sudo apt-get build-dep python-matplotlib
This should get all the dependencies required for installing matplotlib
Try Unofficial Windows Binaries for Python Extension Packages if you are running windows.
http://www.lfd.uci.edu/~gohlke/pythonlibs/
I have followed the steps by Joe Kington on Ubuntu 14.04. Though those steps got me get started ran into few issues. I had to do the following additional steps. Hope it helps someone else who has similar problems.
Install freetype package using
sudo apt-get install libfreetype6-dev
I had to install g++ because of this error:
error trying to exec 'cc1plus': execvp: No such file or directory
sudo apt-get install g++
Then I have to install python3.4-dev because of : fatal error: Python.h: No such file or directory
sudo apt-get install python3.4-dev
Now run the steps from Joe Kington. This worked for me.
It's simplicity itself.
sudo pip install matplotlib will do the trick.