setup-python: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Trying to use Python 3.6 on Ubuntu 16.04:
Execute installation script
##[debug]Check if Python hostedtoolcache folder exist...
##[debug]Deleting Python 3.6.10
##[debug]Create Python 3.6.10 folder
##[debug]Copy Python binaries to hostedtoolcache folder
##[debug]Create additional symlinks (Required for UsePythonVersion VSTS task)
##[debug]Upgrading PIP...
##[debug]Looking in links: /tmp/tmp5xjr9lqz
##[debug]Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages (40.6.2)
##[debug]Requirement already satisfied: pip in /opt/hostedtoolcache/Python/3.6.10/x64/lib/python3.6/site-packages (18.1)
##[debug]Collecting pip
##[debug]Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
##[debug]Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
##[error]The process '/bin/bash' failed with exit code 1
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Set up Python
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 13
- Comments: 50 (6 by maintainers)
resolved.
./configure --with-openssl=/home/username/opensslpython3 -m ssland nothing outputs, it’s ok.If any body still facing issue Follow these steps install openssl with /home/username
set export PATH=$HOME/openssl/bin:$PATH export LD_LIBRARY_PATH=/home/username/openssl/lib export LC_ALL=“en_US.UTF-8” export LDFLAGS=“-L/home/username/openssl/lib -Wl,-rpath,/home/username/openssl/lib” export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/username/openssl/lib/
execute in Python folder ./configure -prefix=/home/username/Python38/ --with-openssl=/home/username/openssl make make install python3 -m ssl
The solution used here (https://bugs.python.org/issue34028#msg339455) helped me:
/usr/local)LD_LIBRARY_PATH:export LD_LIBRARY_PATH=$LD_LIBARY_PATH:/usr/local/lib64:/usr/local/libLD_FLAGS:export LDFLAGS="-L/usr/local/lib -L/usr/local/lib64 -Wl,-rpath,/usr/local/lib -Wl,-rpath,/usr/local/lib64"./configure --with-openssl=/usr/local/and installing withmake && make installpython3 -m sslworkedthanks, resolved.
https://help.dreamhost.com/hc/en-us/articles/360001435926-Installing-OpenSSL-locally-under-your-username seems like it might help
Hi all,
A bit of fudging with this answer solved my problem. (Plus using virtual env.)
I managed to include SSL library with
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/username/openssl/lib/
before step ./configure --with-openssl=/home/username/openssl
now python3 -m ssl give no errors
Nothing worked for me until I yum installed
openssl-develandbzip2-develbefore building python on CentOS. Neither LD manipulation nor setting--with-opensslwhile configuring the build was necessary. The names of those packages foraptwould belibssl-devandlibbz2-dev, but I have not tried it.Got this working for installing Python 3.11.2 on Amazon Linux 2. (An OS Similar to CentOS 7/Rhel 7) I had to install a different openssl version, which Amazon Repo’s provide. You can still leave the regular openssl rpm installed, but you must REMOVE openssl-devel if installed. The three packages you must install AFTER REMOVING openssl-devel are:
Once installed just run ./configure --enable-optimizations (no need for the --with-openssl as the configure script already has a defined locations to look for your openssl, you only need to provide it if your openssl is not within those standard directories, you can find the locations in the script)
Do not let the g fool you, amazon updates their RPM’s without changing the letter at the end, so yes it’s patched for vulnerabilities.
Reference: https://alas.aws.amazon.com/AL2/ALAS-2023-1934.html
Hope this helps!
Also some more info if interested:
Everytime you run ./configure it creates a config.log. I saw it was finding my original openssl in the config.log, however, it was not happy with the version I was using, and the capabilities of that version based on some tests it would do. Which is what led me to find out there was a different openssl Amazon provided in which python3.11.2 was happy with.
If re-running configure on a machine that already has the required libs is all that’s needed, can that be added to setup-python? I feel like almost none of the comments are focusing on the actual Action we are supposedly trying to use.
On Ubuntu (tested on 22.04) it is sufficient to install libssl-dev and then rerun configure. There is no need to install a local openssl.
hello @utapyngo
With the fact that self-hosted environment must have openssl libraries installed and with the solution provided @chasays i believe the issue can be closed. But please feel free to reopen this issue or create another one in case if the problem still exists.
Thanks a lot for all these answers. For me, I also found that it also worked even after I removed the openssl installed in my home directory and cancel export LD_LIBRARY_PATH for it’s lib. So I just tried many other times for digging into it. And I summarize as follows:
Firstly. I installed openssl in my home directory and set its related LD_LIBRARY_PATH before I installed python3.9 from source code with ./configure --with-openssl={openssl path I just installed manually}. And ./pip3 install worked without any SSL error.
Afterwards, I removed the openssl and unset the environment variable for it, but still no SSL error when I use ./pip3 to install packages.
Another time, I remove all the things mentioned above and install openssl again. This time I didn’t set its LD_LIBRARY_PATH and only set --with-openssl={openssl path I just installed manually} and then install python3.9 before I removed openssl again. So there is no manually installed openssl any more. Still, it worked.
In conclusion, I guess the procedure of ‘configure’ python3.9 needs an openssl directory and only needs for ‘configure’, for some reason it cannot find one (I mean it cannot find the default openssl the system already has). So just install and set one explicitly. After configuring, making and installing python, it is of no use for normally running python and pip.
I encountered this problem on one of my lab servers (labeled as 1), but everything went well on another (labeled as 0). I cannot find where is different between them since both default openssl are on /usr (but for 1 is on /usr/local/bin and for 0 on /usr/bin).
try . ~/.profile instead
or editing bashrc
https://askubuntu.com/questions/510709/i-cannot-find-bash-profile-in-ubuntu
I install ssl and use same command , last command not working “python3 -m ssl” , same problem not resolved
I followed your guide but still got some error bro, “/usr/local/bin/python3.10: No module named openssl”
https://github.com/actions/setup-python/issues/93#issuecomment-716433622
https://github.com/actions/setup-python/issues/93#issuecomment-770637487
this worked with the openssl 1.1.1k version for python 3.9.5 on Linux lite ( or a custom kernel based on ubuntu 20.04) .
I had installed openssl source built it following the instructions from that link and then configured from python readme.rst with ./configure --with-openssl=/home/username/openssl --enable-optimizations followed the python make and build instructions and after python3 -m ssl I got no errors and pip worked. I even finally got to update to pip 21.1.2. These posted have helped me the most on a barely mainstream custom linux kernel thank you again everyone.
I was able to get a version of python built to use a openssl in a home directory, however the
setup-pythondoesn’t seem to ever want to use that version. Even setting up the python and python3 symlink in /usr/bin still result it in trying to install its own version and failing. Any advice on how to forcesetup-pythonto use a specific python binary?download python source from https://www.python.org/downloads/source/ such as Python-x.x.x.tgz, then tar -xvf Python-x.x.x.tgz, and cd Python-x.x.x, do /configure --with-openssl=/home/username/openssl.
could you please elaborate on the second step, please ?
@EvanPHamilton, that’s what I did, and it helped. The problem is that the environment variables must be set individually for every Python version because the Github Actions runner does not work with openssl1.1.