4

I'm working with a older server running Linux 6. I was asked to install aws-CLI on the machine to allow us to start saving files directly to s3 buckets. This requires python 3.4 or higher (starting Jan 2020).

After my first attempt I received the following error:

# pip3 install awscli --upgrade --user
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting awscli
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/awscli/
  Could not fetch URL https://pypi.org/simple/awscli/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/awscli/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  ERROR: Could not find a version that satisfies the requirement awscli (from versions: none)
ERROR: No matching distribution found for awscli
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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

Basically SSL packages are missing. I installed a few packages from YUM and reran the ./configure, make, and make install and still had the SSL module error.

With the help of a few posts and blogs I and now able to get this error where the SSL package is seen but not imported. At this time I've been able to install Python-3.8, from source. During the make process I see the following lines.

# ./configure --with-openssl=/usr/src/openssl-1.0.2o --enable-optimizations
# make

Following modules built successfully but were removed because they could not be imported:
_hashlib              _ssl


Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().

Then trying to import the package within Python I get the following:

python3.8
Python 3.8.0 (default, Oct 17 2019, 10:40:08)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.8/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
>>> exit()

Any additional ideas I could try to get to the end goal of installing aws-cli on RHEL6? Please include any steps I need to cleanup/uninstall any of the mess that could currently be in place.

References I've tried:

  1. https://stackoverflow.com/questions/53543477/building-python-3-7-1-ssl-module-failed
  2. https://jameskiefer.com/posts/installing-python-3.7-on-debian-8/
    ^ I know it's Dabian but steps to install ssl from source was helpful
  3. https://stackoverflow.com/questions/32856389/how-to-import-ssl-in-python-2-7-6

2 Answers 2

3

I ran into the same problem and got it working by adding the path to openssl libraries to rpath:

LDFLAGS=-Wl,-rpath=/usr/src/openssl-1.0.2o/lib
./configure --with-openssl=/usr/src/openssl-1.0.2o --enable-optimizations
make
0

You might find an rpm of Python >3.4 you can install on your Centos 6 system at IUScommunity. (Google for their URL.) This would bypass your issues caused by trying to compile Python from scratch.

I have no connection with them beyond having used their yum repository over the last few months.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .