7

I'm using Kali Linux 2020.1, I installed Python3.7, then after trying to install modules using pip3 command I keep getting this error message.

  WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
    ERROR: Could not find a version that satisfies the requirement flask (from versions: none)
    ERROR: No matching distribution found for flask

    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
2

I think you may have inadvertently installed without something it needs. The error looks similar to one generated by the python requests library.

I would check this is properly installed and it's dependencies are met. I notice that python-openssl is only a suggested package and not a required one. You might want to see if installing this one helps.

Package: python3-requests
Depends: python3-certifi, python3-chardet (<< 3.1.0), python3-idna, python3-urllib3 (<< 1.26), python3:any, ca-certificates, python3-chardet (>= 3.0.2), python3-urllib3 (>= 1.21.1)
Suggests: python3-cryptography, python3-idna (>= 2.5), python3-openssl, python3-socks, python-requests-doc
| improve this answer | |
0

To do we must compile it and install each dependency

  • Download if need https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.x
  • Unpack file
    tar zxvf Python-3.7.0.tar.gz --directory /tmp
    cd /tmp
    
  • Edit file Setup.dist to enabled SSL
    cd Python-3.7.0/Modules/
    vi Setup.dist
    
  • un-comment following line and update openssl home
    SSL=/usr/local/ssl  <--- substitute with your openssl home directory
    _ssl _ssl.c \
            -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
            -L$(SSL)/lib -lssl -lcrypto
    
  • save and compile python for distribution
    cd ../
    ./configure --enable-optimizations CFLAGS="-O3" --prefix=/opt/primeur/python3.7
    make
    make install
    
  • Try it

    cd /opt/primeur/python3.7/bin
    [root@myserver bin]# python3
    
    Python 3.7.0 (default, May 5 2020, 22:31:07)
    
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
    
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    
  • update pip with command

    [root@myserver bin]#./pip3 install --upgrade pip
    
  • install any dependency using pip3 install like

    [root@myserver bin]#./pip3 install termcolor
    
    Collecting termcolor
    Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
    Installing collected packages: termcolor
    Running setup.py install for termcolor ... done
    Successfully installed termcolor-1.1.0
    
| improve this answer | |
  • 2
    It's unusual to install any python module this way. Could you explain why it needs to be built from source rather than installing via one of the mainstream channels? eg: install using apt – Philip Couling May 12 at 13:33
  • 1
    because I install on RedHat without YUM – Andrea Fontana May 12 at 16:43
  • 1
    This question is about installing on Kali Linux which does have apt. – Philip Couling May 12 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.