pip is configured with locations that require tls/ssl linux

pip is configured with locations that require tls/ssl linux

pip is configured with locations that require tls/ssl linux – Here is the configuration issue we received from our user.

The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. (tried sudo -H, the rest errors persist)  
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.    
Collecting numpy  
  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/  
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  
$ python -V
Python 3.7.3  
$ pip -V
pip 19.0.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
$ whereis pip
pip: /usr/local/bin/pip2.7 /usr/local/bin/pip3.7 /usr/local/bin/pip /usr/local/bin/pip3.6  

pip3.6 appeared after:

$ sudo su
$ update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Pip works well in anaconda environments.

Is it preferable to delete Python-related files to a safe extent – without destroying the system – and then reinstall everything properly? And what’s the best way to go about it?

I know there are a lot of similar problems, but I’ve tried a lot of different things (clearly, I’ve made a mistake) and haven’t been able to solve the problem.

Here is how it can be fixed!

  1. If you don’t require sudo, don’t use it.
  2. Because you’re using Python 3, pip3 is the best approach to install a package in Python

As a result, the command will be: pip3 install --user <package_name> Where:

    • Python 3 is represented by pip3.
    • To use pip3 to install a package, type install.
    • –user saves the downloaded package in the current user’s directory (thus eliminating the requirement for further rights).
    • package_name any Python package.

EDIT:

  1. Install the Python and SSL packages you’ll need: sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
  2. Download and unzip “Python-3.7.0.tar.xz” into your home directory from https://www.python.org/ftp/python/.
  3. Run the following command in a terminal window in that directory: ./configure
  4. Build and install: sudo make && sudo make install
  5. Install packages with: pip3 install package_name