pip3 installs inside virtual environment with python3.6 failing due to ssl module not available

Py_minion picture Py_minion · Jan 5, 2017 · Viewed 76.7k times · Source

(py36venv) vagrant@pvagrant-dev-vm:/vagrant/venvs$ pip3 install pep8

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Collecting pep8 Could not fetch URL https://pypi.python.org/simple/pep8/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping

Could not find a version that satisfies the requirement pep8 (from versions: ) No matching distribution found for pep8

Background information - Trying to move to python 3.6.

Installed python3.6 using the below commands:

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz

tar -xvf Python-3.6.0.tgz

cd Python-3.6.0
./configure --enable-optimizations
make -j8 sudo make altinstall python3.6

Created virtualenv by:

python3.6 -m venv py36venv

source py36venv/bin/activate

Tried to install pep8

(py36venv) pip3 install pep8

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting pep8

Could not fetch URL https://pypi.python.org/simple/pep8/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the

SSL module is not available. - skipping Could not find a version that satisfies the requirement pep8 (from versions: ) No matching distribution found for pep8

Answer

Py_minion picture Py_minion · Jan 11, 2017

I followed the below steps for python3.6 installation in ubuntu 14.04 and virtualenv pip installs works fine.

Python 3.6 Installation:

sudo apt-get install python3-dev libffi-dev libssl-dev
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz  
tar xvf Python-3.6.0.tgz
cd Python-3.6.0
./configure --enable-optimizations  
make -j8  
sudo make altinstall
python3.6

If seeing the following error --

zipimport.ZipImportError: can't decompress data; zlib not available make: *** [altinstall] Error 1

try:

sudo apt-get install zlib1g-dev

Validation:

Create virtualenv in python3.6:

python3.6 -m venv testenv
source testenv/bin/activate
pip install pep8

using pip:

(testenv) vagrant@pvagrant-dev-vm:~$ pip install pep8
*Collecting pep8
  Downloading pep8-1.7.0-py2.py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 4.1MB/s
Installing collected packages: pep8
Successfully installed pep8-1.7.0*

(testenv) vagrant@pvagrant-dev-vm:~$ pip list

pep8 (1.7.0) 
pip (9.0.1)
setuptools (28.8.0)