2

With pip on Ubuntu 14.04, I am getting this error:

Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 64, in <module>
vendored("cachecontrol")
File "/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py", line 36, in vendored
__import__(modulename, globals(), locals(), level=0)
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/__init__.py", line 9, in <module>
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/wrapper.py", line 1, in <module>
File "/usr/share/python-wheels/CacheControl-0.11.7-py2.py3-none-any.whl/cachecontrol/adapter.py", line 4, in <module>
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/__init__.py", line 52, in <module>
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/packages/__init__.py", line 59, in <module>
File "/usr/share/python-wheels/requests-2.12.4-py2.py3-none-any.whl/requests/packages/__init__.py", line 32, in vendored
File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py", line 47, in <module>
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

How can I solve this?

  • Could you please install pyOpenSSL 16.2.0 and see if this is fixed? – chazecka Sep 13 '17 at 18:26
  • What commands were you running with pip? – edwinksl Oct 6 '17 at 15:34
1

Use pip3

I had to switch over to using pip3 to resolve this issue:

$ sudo pip3 install --upgrade pyopenssl

0

I found that this answer on stackoverflow helped. Basically, it says that you should do this:

rm -rf /home/<Your Username>/.local/lib/python2.7/site-packages/OpenSSL
sudo rm -rf usr/local/lib/python2.7/dist-packages/OpenSSL/
pip install pyOpenSSL
0

yeah pip errors until you fix it manually (chicken and egg mentioned)....find where the library is installed and manually delete it.

On my 16.04 installation I did this:

cd /usr/lib/python2.7/dist-packages
rm -rf OpenSSL

Then pip worked correctly without the SSL error

pip install pyopenssl

  • 2
    Removing packages manually from /usr/lib/python*/dist-packagescan be dangerous as it may break package updates from OpenSSL that provide the Python libraries. You should refrain from manually removing files from package-manager-controlled directories when you can. – Thomas Ward Jul 10 '18 at 14:24
0

Try this:

sudo apt-get update    
sudo easy_install -U cryptography

Then install pyopenssl package:

pip install pyopenssl

I hope this works. Cheers!

-1

You are missing pyOpenSSL package, or is outdated.

simply run

$ pip install pyopenssl

and update packages (may not be necessary).

  • 2
    .....but you can't do that, because pip is throwing the error! Classic chicken-and-egg problem here..... – starbeamrainbowlabs Apr 26 '18 at 18:26

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.