skip to Main Content

New Python 3.7.1 installation on GoDaddy VPS CentOs 7.
Attempt pip3 install virtualenv or python 3 -m pip install virtualenv and get:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

openssl-devel installed and up to date

This question has been asked and answered many times, but the solutions I’ve found have not solved my problem.
Thank you all!

I tried the CentOs and Linux-based solutions in the following:

"SSL module in Python is not available" when installing package with pip3
# 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.7.1/Python-3.7.1.tar.xz
tar xf Python-3.7.1.tar.xz
cd Python-3.7.1

  # Configure the build w/ your installed libraries
  ./configure

  # Install into /usr/local/bin/python3.6, don't overwrite global python bin
  make altinstall

Trying to install packages with Python 3.7.2 pip causes TSL/SSL errors

"SSL module in Python is not available" when installing package with pip3

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

pip cannot confirm SSL certificate: SSL module is not available

"ssl module in Python is not available"
and
pip cannot confirm SSL certificate: SSL module is not available

  `uncommented suggestions for CentOs
  make install failed:
    gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration   -I. -I./Include     -DUSE_SSL -I/include -I/include/openssl -c ./Modules/_ssl.c -o Modules/_ssl.o
    ./Modules/_ssl.c:74:6: error: #error "libssl is too old and does not support X509_VERIFY_PARAM_set1_host()"
    ./Modules/_ssl.c: In function ‘_ssl_configure_hostname’:
    ./Modules/_ssl.c:861: error: implicit declaration of function ‘SSL_get0_param’
    ./Modules/_ssl.c:861: warning: initialization makes pointer from integer without a cast
    ./Modules/_ssl.c:863: error: implicit declaration of function ‘X509_VERIFY_PARAM_set1_host’
    ./Modules/_ssl.c:869: error: implicit declaration of function ‘X509_VERIFY_PARAM_set1_ip’
    ./Modules/_ssl.c: In function ‘_ssl__SSLContext_impl’:
    ./Modules/_ssl.c:2988: error: ‘X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS’ undeclared (first use in this function)
    ./Modules/_ssl.c:2988: error: (Each undeclared identifier is reported only once
    ./Modules/_ssl.c:2988: error: for each function it appears in.)
    ./Modules/_ssl.c:3093: error: implicit declaration of function ‘SSL_CTX_get0_param’
    ./Modules/_ssl.c:3093: warning: assignment makes pointer from integer without a cast
    ./Modules/_ssl.c:3099: error: implicit declaration of function ‘X509_VERIFY_PARAM_set_hostflags’
    ./Modules/_ssl.c: In function ‘get_verify_flags’:
    ./Modules/_ssl.c:3397: warning: assignment makes pointer from integer without a cast
    ./Modules/_ssl.c: In function ‘set_verify_flags’:
    ./Modules/_ssl.c:3410: warning: assignment makes pointer from integer without a cast
    ./Modules/_ssl.c: In function ‘set_host_flags’:
    ./Modules/_ssl.c:3573: warning: assignment makes pointer from integer without a cast
    make: *** [Modules/_ssl.o] Error 1`

https://www.tomordonez.com/pip-install-ssl-module-python-is-not-available.html

7

Answers


  1. Chosen as BEST ANSWER

    Solution: Python 3.6.2 instead of 3.7.1


  2. I have seen this error when the version of openssl is incompatible. This is more likely when you’re installing a newer Python (such as 3.7.2) on a not-as-recent version of the Linux system.

    I would check to see what version of SSL libraries are expected with this version of Python and if necessary, install them locally.

    This is a basic description of building the SSL libraries: DreamHost instructions for Installing Local OpenSSL Version

    You will want to build Python again with the following option added to your invocation of ./config:

    --with-openssl=/path/to/your/local/install
    
    Login or Signup to reply.
  3. Please read this article

    Basically you need to install openssl first and uncomment ssl related lines in Modules/Setup file in python source code before to make install.
    This worked to me on installing Python 3.8.

    Login or Signup to reply.
  4. Here is a working solution for Python 3.7.9 and CentOS 7.8.2003:

    su - root
    yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel -y
    cd /usr/src
    wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
    tar xzf Python-3.7.9.tgz
    cd Python-3.7.9
    

    In /usr/src/Python-3.7.9/Modules/Setup.dist, uncomment these 4 lines:

    SSL=/usr/local/ssl
    _ssl _ssl.c 
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl 
        -L$(SSL)/lib -lssl -lcrypto
    

    And finally:

    ./configure --enable-optimizations
    make altinstall
    
    Login or Signup to reply.
  5. Minor correction to a prev answer by Kevin Lemaire

    Here is a working solution for Python 3.7.9 and CentOS 7.8.2003:

    su - root
    yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel -y
    cd /usr/src
    wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
    tar xzf Python-3.7.9.tgz
    cd Python-3.7.9
    

    In Modules/Setup, uncomment these 4 lines: <<< minor correction

    SSL=/usr/local/ssl
    _ssl _ssl.c 
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl 
        -L$(SSL)/lib -lssl -lcrypto
    

    And finally:

    ./configure --enable-optimizations
    make altinstall
    
    Login or Signup to reply.
  6. Taking inspiration from the two answers on this thread, downloading and extracting OpenSSL 1.1.1o and then running the following sequence of commands solved the problem for me.

    su - root
    yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel -y
    cd /usr/src
    wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
    tar xzf Python-3.7.9.tgz
    cd Python-3.7.9
    ./configure --enable-optimizations --with-openssl=/path/to/your/local/install
    make install
    
    Login or Signup to reply.
  7. This works for me on CentOS 7.9 with Python 3.10.9 based on https://bugs.python.org/issue47201

    This edits configure instead of Modules/Setup:

    sudo yum install -y epel
    sudo yum install -y openssl11-devel
    wget https://www.python.org/ftp/python/3.10.9/Python-3.10.9.tgz
    tar zxvf Python-3.10.9.tgz
    cd Python-3.10.9
    sed -i 's/PKG_CONFIG openssl /PKG_CONFIG openssl11 /g' configure
    ./configure --enable-optimizations
    sudo make altinstall
    # The following should run without errors if SSL was properly compiled
    python3.10 -m ssl
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search