Cannot install package packages in python 3.6 due to ssl error

I work on a remote server. When I try to install using pip in my virtual environment, I get an error message:

(venv) [barta@bivoj program]$ pip install -r requirements.txt 
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting joblib==0.11 (from -r requirements.txt (line 1))
  Could not fetch URL https://pypi.python.org/simple/joblib/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping

Everything works fine with python 2.7. Can I solve this problem myself (I do not have root access) or do I need to contact the administrator?

I first had this problem when I installed python 3.6 in my home folder. I realized that the problem could be due to the fact that it is in my home folder, so I asked for a clean install of python 3.6.

I considered changing setup.py and installing it again in my house, as suggested here by Claudio:

pip3 installs inside a virtual environment with python3.6 error due to inaccessibility of ssl module

but I did not find the openssl folder. There is openssl in / usr / bin, but it is not a directory. I searched the ssl.h file but did not find it anywhere.

+8
source share
5 answers

It looks like you created python from a source without libssl-devpresent.

Run:

sudo apt-get install libssl-dev
sudo ./configure
sudo make altinstall
+8
source

Tested on Ubuntu 16.04 / 18.04

In Python-3.6.4 / Modules / Setup, uncomment the following lines:

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

Then recompile the package:

$ sudo ./configure --enable-optimizations
$ sudo make altinstall

Also make sure that it is libssl-devinstalled (in any case, it is a package for Debian).

This also works for Python-3.7.x.

+1
source

, python, python2.7.13, python ​​ :

./configure --prefix /usr/bin/python2.7.13
make altinstall

virtualenv:

virtualenv --python=/usr/bin/python2.7.13/bin/python2.7 py2.7.13env

, , libreadline6-dev. :

sudo apt-get install libreadline6-dev

make install, , env. !

0

:

sudo apt-get install libssl-dev
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar -xvf Python-3.6.5.tgz
cd Python-3.6.5/

./configure
sudo make
sudo make install
0

Source: https://habr.com/ru/post/1676950/


All Articles