Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST' #4

Open
hanzheteng opened this issue Jun 10, 2018 · 2 comments

Comments

@hanzheteng
Copy link

Hi @gzhang8 ,

Thanks for your great contributions to ROS community, which indeed helped me a lot.

However, I followed your instructions and got an issue.

When running sudo -H pip install pandas jinja2 I got the traceback error

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, requests, six
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/local/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 204, in <module>
    if _lib.Cryptography_HAS_SSL_ST:
AttributeError: 'module' object has no attribute 'Cryptography_HAS_SSL_ST'

I guess this error comes from the old version of some library. After searching on Google I found an solution. (need to check if the directory exists before removing it, in some system the path should be /usr/lib)
$ sudo rm -rf /usr/local/lib/python2.7/dist-packages/OpenSSL/
$ sudo apt install --reinstall python-openssl

This solved my problem. But after running sudo -H pip install pandas jinja2, I got an warning message in red color, though the pandas and jinja2 packages are installed successfully.

pyopenssl 17.5.0 has requirement cryptography>=2.1.4, but you'll have cryptography 1.2.3 which is incompatible.
astroid 1.6.0 has requirement enum34>=1.1.3; python_version < "3.4", but you'll have enum34 1.1.2 which is incompatible.

I am not sure if this solution will bring some other potential risks in the future.

By the way, why not put this repo into a ROS package? Then beginners can just git clone and catkin make to start their first try.

@gzhang8
Copy link
Contributor

gzhang8 commented Jun 21, 2018

Thank you @hanzheteng for your feedback. What version of Ubuntu are you using? It seems there is a compatibility issue between packages from pip and apt. I will investigate this problem when I have time.

This repo is in this format hoping that beginners can learn a little more about how a repo is created from scratch. Do you think it helps in this way?

@hanzheteng
Copy link
Author

hanzheteng commented Jun 21, 2018

I am using Ubuntu 16.04.3 LTS.

Just now I wanted to check the version of pip, and found that even pip itself cannot run, with the traceback

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, requests, six
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 86, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/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'

Then I solved it by sudo python -m easy_install --upgrade pyOpenSSL.

Right now the version of my pip is
pip 10.0.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

I checked the source directory that, before I upgraded the openssl above, the version of pip was also 10.0.1. pip doesn't work due to the problem of openssl.

I have a snapshot in Virtualbox created before running sudo -H pip install pandas jinja2. I will check it later, just leaving the prompt message here for your information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants