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

Viewed 613

I know this has been asked before (multiple times), however i still couldnt figure it out for my case.

Goal: Install working python3.10 on Ubuntu ec2-instance and install packages.

done so far: installed python3.10 using the following steps:

sudo yum update -y
sudo yum groupinstall "Development Tools" -y
sudo yum install openssl-devel libffi-devel bzip2-devel wget -y
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
tar -xf Python-3.10.*.tgz
cd Python-3.10.*/
sudo ./configure --enable-optimizations
sudo make altinstall

It seemed to work as i got

$ python3.10 --version
Python 3.10.0

however, when trying to upgrade pip or install a package, i get:

$ pip install numpy==1.21.4
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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/numpy/
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/numpy/
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/numpy/
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/numpy/
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/numpy/
Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (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 numpy==1.21.4 (from versions: none)
ERROR: No matching distribution found for numpy==1.21.4
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

checking sudo yum install openssl-devel libffi-devel bzip2-devel wget -y gives:

Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                      | 3.7 kB  00:00:00     
Package 1:openssl-devel-1.0.2k-19.amzn2.0.10.x86_64 already installed and latest version
Package libffi-devel-3.0.13-18.amzn2.0.2.x86_64 already installed and latest version
Package bzip2-devel-1.0.6-13.amzn2.0.3.x86_64 already installed and latest version
Package wget-1.14-18.amzn2.1.x86_64 already installed and latest version
Nothing to do

so everything seemed fine here.

however

$ sudo yum groupinstall "Development Tools" -y
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Maybe run: yum groups mark install (see man yum)
No packages in any requested group available to install or update

which i must have overlooked initially.

I then ran:

sudo yum install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                      | 3.7 kB  00:00:00     
No package build-essential available.
No package zlib1g-dev available.
No package libncurses5-dev available.
No package libgdbm-dev available.
No package libnss3-dev available.
No package libssl-dev available.
No package libreadline-dev available.
No package libffi-dev available.
Error: Nothing to do

the Dev tools missing i think are the cause for the ssl error, however i dont know how to install them.

I then tried to start from scratch and uninstall python3.10, running

$ sudo yum remove python3
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package python3.x86_64 0:3.7.10-1.amzn2.0.1 will be erased
--> Processing Dependency: python(abi) = 3.7 for package: python3-docutils-0.14-1.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-pystache-0.5.4-12.amzn2.0.1.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-libs-3.7.10-1.amzn2.0.1.x86_64
--> Processing Dependency: python(abi) = 3.7 for package: python3-daemon-2.2.3-8.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-pip-20.2.2-1.amzn2.0.3.noarch
--> Processing Dependency: python(abi) = 3.7 for package: aws-cfn-bootstrap-2.0-9.amzn2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: 1:python3-lockfile-0.11.0-17.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-simplejson-3.2.0-1.amzn2.0.2.x86_64
--> Processing Dependency: python(abi) = 3.7 for package: python3-setuptools-49.1.3-1.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-docutils-0.14-1.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-pystache-0.5.4-12.amzn2.0.1.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-libs-3.7.10-1.amzn2.0.1.x86_64
--> Processing Dependency: python(abi) = 3.7 for package: python3-daemon-2.2.3-8.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-pip-20.2.2-1.amzn2.0.3.noarch
--> Processing Dependency: python(abi) = 3.7 for package: aws-cfn-bootstrap-2.0-9.amzn2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: 1:python3-lockfile-0.11.0-17.amzn2.0.2.noarch
--> Processing Dependency: python(abi) = 3.7 for package: python3-simplejson-3.2.0-1.amzn2.0.2.x86_64
--> Processing Dependency: python(abi) = 3.7 for package: python3-setuptools-49.1.3-1.amzn2.0.2.noarch
--> Processing Dependency: python3 for package: aws-cfn-bootstrap-2.0-9.amzn2.noarch
--> Processing Dependency: python3(x86-64) = 3.7.10-1.amzn2.0.1 for package: python3-libs-3.7.10-1.amzn2.0.1.x86_64
--> Running transaction check
---> Package aws-cfn-bootstrap.noarch 0:2.0-9.amzn2 will be erased
---> Package python3-daemon.noarch 0:2.2.3-8.amzn2.0.2 will be erased
---> Package python3-docutils.noarch 0:0.14-1.amzn2.0.2 will be erased
---> Package python3-libs.x86_64 0:3.7.10-1.amzn2.0.1 will be erased
---> Package python3-lockfile.noarch 1:0.11.0-17.amzn2.0.2 will be erased
---> Package python3-pip.noarch 0:20.2.2-1.amzn2.0.3 will be erased
---> Package python3-pystache.noarch 0:0.5.4-12.amzn2.0.1 will be erased
---> Package python3-setuptools.noarch 0:49.1.3-1.amzn2.0.2 will be erased
---> Package python3-simplejson.x86_64 0:3.2.0-1.amzn2.0.2 will be erased
--> Finished Dependency Resolution
amzn2-core/2/x86_64                                                                                                             | 3.7 kB  00:00:00     

Dependencies Resolved

=======================================================================================================================================================
 Package                                 Arch                        Version                                    Repository                        Size
=======================================================================================================================================================
Removing:
 python3                                 x86_64                      3.7.10-1.amzn2.0.1                         @amzn2-core                       36 k
Removing for dependencies:
 aws-cfn-bootstrap                       noarch                      2.0-9.amzn2                                @amzn2-core                      3.6 M
 python3-daemon                          noarch                      2.2.3-8.amzn2.0.2                          @amzn2-core                      164 k
 python3-docutils                        noarch                      0.14-1.amzn2.0.2                           @amzn2-core                      4.6 M
 python3-libs                            x86_64                      3.7.10-1.amzn2.0.1                         @amzn2-core                       38 M
 python3-lockfile                        noarch                      1:0.11.0-17.amzn2.0.2                      @amzn2-core                       90 k
 python3-pip                             noarch                      20.2.2-1.amzn2.0.3                         @amzn2-core                       11 M
 python3-pystache                        noarch                      0.5.4-12.amzn2.0.1                         @amzn2-core                      676 k
 python3-setuptools                      noarch                      49.1.3-1.amzn2.0.2                         @amzn2-core                      5.3 M
 python3-simplejson                      x86_64                      3.2.0-1.amzn2.0.2                          @amzn2-core                      710 k

Transaction Summary
=======================================================================================================================================================
Remove  1 Package (+9 Dependent packages)

Installed size: 64 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : aws-cfn-bootstrap-2.0-9.amzn2.noarch                                                                                               1/10 
  Erasing    : python3-daemon-2.2.3-8.amzn2.0.2.noarch                                                                                            2/10 
  Erasing    : python3-pystache-0.5.4-12.amzn2.0.1.noarch                                                                                         3/10 
  Erasing    : python3-docutils-0.14-1.amzn2.0.2.noarch                                                                                           4/10 
  Erasing    : 1:python3-lockfile-0.11.0-17.amzn2.0.2.noarch                                                                                      5/10 
  Erasing    : python3-simplejson-3.2.0-1.amzn2.0.2.x86_64                                                                                        6/10 
  Erasing    : python3-pip-20.2.2-1.amzn2.0.3.noarch                                                                                              7/10 
  Erasing    : python3-3.7.10-1.amzn2.0.1.x86_64                                                                                                  8/10 
  Erasing    : python3-libs-3.7.10-1.amzn2.0.1.x86_64                                                                                             9/10 
  Erasing    : python3-setuptools-49.1.3-1.amzn2.0.2.noarch                                                                                      10/10 
  Verifying  : python3-libs-3.7.10-1.amzn2.0.1.x86_64                                                                                             1/10 
  Verifying  : python3-simplejson-3.2.0-1.amzn2.0.2.x86_64                                                                                        2/10 
  Verifying  : python3-pip-20.2.2-1.amzn2.0.3.noarch                                                                                              3/10 
  Verifying  : python3-daemon-2.2.3-8.amzn2.0.2.noarch                                                                                            4/10 
  Verifying  : python3-setuptools-49.1.3-1.amzn2.0.2.noarch                                                                                       5/10 
  Verifying  : python3-pystache-0.5.4-12.amzn2.0.1.noarch                                                                                         6/10 
  Verifying  : 1:python3-lockfile-0.11.0-17.amzn2.0.2.noarch                                                                                      7/10 
  Verifying  : python3-docutils-0.14-1.amzn2.0.2.noarch                                                                                           8/10 
  Verifying  : aws-cfn-bootstrap-2.0-9.amzn2.noarch                                                                                               9/10 
  Verifying  : python3-3.7.10-1.amzn2.0.1.x86_64                                                                                                 10/10 

Removed:
  python3.x86_64 0:3.7.10-1.amzn2.0.1                                                                                                                  

Dependency Removed:
  aws-cfn-bootstrap.noarch 0:2.0-9.amzn2           python3-daemon.noarch 0:2.2.3-8.amzn2.0.2          python3-docutils.noarch 0:0.14-1.amzn2.0.2       
  python3-libs.x86_64 0:3.7.10-1.amzn2.0.1         python3-lockfile.noarch 1:0.11.0-17.amzn2.0.2      python3-pip.noarch 0:20.2.2-1.amzn2.0.3          
  python3-pystache.noarch 0:0.5.4-12.amzn2.0.1     python3-setuptools.noarch 0:49.1.3-1.amzn2.0.2     python3-simplejson.x86_64 0:3.2.0-1.amzn2.0.2    

Complete!

it said "Complete" which sounded good, however if i check, i still get

$ python3 --version
Python 3.10.0

It talks a lot about python3.7 instead 3.10 f or some reason, even though checking python3 version shows python3.10, so i thought python3 will refer to 3.10. I ran it again anyways, specifying 3.10 this time:

$ sudo yum remove python3.10
Failed to set locale, defaulting to C
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
No Match for argument: python3.10
No Packages marked for removal

trying to remove python3 (not specifying 3.10) now also gives the same output

So now i m left with 3 questions:

  • How do i install the Dev-Tools?
  • Will this resolve the ssl error from the title?
  • How do i uninstall python3.10 to make a fresh restart?

Thanks to anyone taking the time!

0 Answers
Related