Pip error: object 'module' does not have attribute 'Cryptography_HAS_SSL_ST'

I tried to install from pip and keep getting errors of this type.

$ pip install quandl Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> load_entry_point('pip==1.5.6', 'console_scripts', 'pip')() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point return ep.load() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load return self.resolve() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module> from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module> from pip.download import path_to_url File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module> import requests, six File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module> from .packages.urllib3.contrib import pyopenssl File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 53, in <module> import OpenSSL.SSL File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module> from OpenSSL import rand, crypto, SSL File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module> if _lib.Cryptography_HAS_SSL_ST: AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST' 

Now, although I tried to install different pip modules, I get the same error. Is there any solution for this? This was caused by an unexpected process termination while loading the pip module.

Please help me with the necessary steps to fix this error.

I tried to fix it

 $ pip install -U cryptography Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> load_entry_point('pip==1.5.6', 'console_scripts', 'pip')() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point return ep.load() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2355, in load return self.resolve() File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2361, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module> from pip.vcs import git, mercurial, subversion, bazaar # noqa File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module> from pip.download import path_to_url File "/usr/lib/python2.7/dist-packages/pip/download.py", line 22, in <module> import requests, six File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line 53, in <module> from .packages.urllib3.contrib import pyopenssl File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line 53, in <module> import OpenSSL.SSL File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module> from OpenSSL import rand, crypto, SSL File "/home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL/SSL.py", line 112, in <module> if _lib.Cryptography_HAS_SSL_ST: AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST' 
+13
source share
9 answers

Ubuntu 16.04.3 here:

I think I fixed this by removing the python-openssl package (and its dependencies) with:

 apt-get --auto-remove remove python-openssl 

Then install the latest version using pip:

 pip install pyOpenSSL 

Of course, if you install another apt package that depends on it, it will return it back. I hope that now you use pip for everything you can, instead of apt, everything will be fine.

Edit: as of January 2019, this issue seems to no longer exist.

+28
source

I managed to solve this problem by uninstalling libslb lib and reinstalling (cleaning before installation does not work):

 $ sudo rm -rf /usr/local/lib/python2.7/dist-packages/OpenSSL/ $ sudo apt install --reinstall python-openssl 
+9
source

To install it on RHEL / CentOS:

 sudo rm -rf /usr/lib/python2.7/site-packages/OpenSSL/ sudo yum install pyOpenSSL 

It did it for me on CentOS 7. Greetings!

+2
source

I got this error and solved it by following these steps ( do not forget to specify your own username ):

 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 
+1
source

If even pip does not work, try the following:

 sudo easy_install -U cffi sudo easy_install -U cryptography 

It works for me.

+1
source

Try reinstalling python, from which it will fix many of your problems,

 sudo apt-get install --reinstall python2.7 

and when reinstalling there will be no pip, do

 sudo apt-get install python-pip 
0
source

Quick fix

Move the OpenSSL folder to OpenSSLBAK (for example) to avoid an error

 # cd /usr/lib/python2.7/dist-packages # mv OpenSSL OpenSSLBAK 

That should be good

0
source

Try the following:

 $ rm -rf /home/ubuntu/.local/lib/python2.7/site-packages/OpenSSL $ rm -rf /home/ubuntu/.local/lib/python2.7/site-packages/pyOpenSSL-0.15.1.egg-info 

On the last line, you may have another version of pyOpenSSL , specify yours.

0
source

Try downloading the appropriate wheel file from here depending on your operating system and python version. Then add this file to Python / Scripts and use the following code to install it.

 pip install nameofwheelfile.whl 

The wheel file contains all the dependencies.

-1
source

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


All Articles