question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'

See original GitHub issue

I’ve used the python:3.7.6-slim-stretch docker image for almost one year. Just today I got this strange issue (with pyOpenSSL==17.5.0):

>>> from OpenSSL import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/usr/local/lib/python3.7/site-packages/OpenSSL/SSL.py", line 673, in <module>
_lib.Cryptography_HAS_TLSEXT_HOSTNAME, "SNI not available"
AttributeError: module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'

The only versions that work correctly are pyOpenSSL==19.1.0 and pyOpenSSL==20.0.0.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
reaperhulkcommented, Dec 9, 2020

Upgrading pyopenssl will resolve this error. Cryptography removed the binding because pyopenssl 19.1 and above no longer depend on it.

1reaction
mhaggagcommented, Dec 9, 2020

We had this error pop up on one of servers today, and after comparing the dependent packages for pyopenssl on working servers vs the non-working server, I found that reverting cryptography from 3.3 to 3.2 (using pip3 install cryptography==3.2) works around this error until we figure out what’s going on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[SOLVED] AttributeError: module 'lib' has no attribute ...
Following an update on my CentOS 8, "certbot renew" cannot run and throws the following error: Code: Traceback (most recent call last): ...
Read more >
AttributeError: module 'lib' has no attribute ... - CentOS forum
AttributeError : module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME' ... as a first line respond following any dnf command. I am ...
Read more >
Bug #48506: AttributeError: module 'lib' has no attribute ...
Cryptography_HAS_TLSEXT_HOSTNAME, "SNI not available" AttributeError: module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'.
Read more >
AttributeError: module 'lib' has no attribute ... - Stack Overflow
@Daimto I am using the json file. After a few trials and error I did find that the error was due to conflicting...
Read more >
What may be the cause of this error? AttributeError: module 'lib ...
GitHub: AttributeError: module 'lib' has no attribute 'X509_up_ref' · Issue #728 · pyca/pyopenssl. Oh lol cryptography jumped from version 3.4.8 to 35.0.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found