Python Cryptography Error cannot import name certificate_transparency
Solution 1
I was using pip 7 and got the same problem. Upgrading to pip 9 solved it. I'm not sure about the cause.
Via: https://github.com/micheloosterhof/cowrie/issues/618
Solution 2
I've been hitting this while attempting to update Python Cryptography for Solaris 11.4, using the https://github.com/oracle/solaris-userland/ build system. A "simple" update to pip isn't an option for me, that's not how we do things.
I eventually figured out the solution: I'd built the package incorrectly.
Cryptography 2.1.4 depends on cffi > 1.7. Both of these packages have new deliverable bits compared to the versions we were shipping.
Failing to update the package manifest to correctly track the new files results in both cffi and cryptography being unable to import symbols that the current versions depend upon.
[A very big thankyou to Alex Gaynor in #cryptography-dev who set me on the right path to figuring this out].
$ python2.7
Python 2.7.14 (default, Jan 31 2018, 05:35:05) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.bindings._openssl import ffi, lib
>>> from cryptography.x509 import certificate_transparency
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/vendor-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509 import certificate_transparency
ImportError: cannot import name certificate_transparency
If you build cryptography and look at what it delivers, you will find that there is in fact a file (shipped on Solaris as /usr/lib/python-$(PYVER)/vendor-packages/cryptography/x509/certificate_transparency.py
) - and if that file isn't in the rest of the hierarchy then you end up with exactly this ImportError.
Solution 3
it works for me (problems with paramiko):
https://pypi.python.org/pypi/ctutlz/0.7.0
pip install --process-dependency-links ctutlz
Emerson
Updated on June 04, 2022Comments
-
Emerson almost 2 years
trying to run a pymodbus tcp server and im getting this stack trace... at a total loss here so any help is appreciated. Thanks!
Traceback (most recent call last): File "Worrking_ModbusJ1939Bridge.py", line 12, in <module> from pymodbus.server.async import StartTcpServer File "build/bdist.linux-armv7l/egg/pymodbus/server/async.py", line 18, in <module> File "build/bdist.linux-armv7l/egg/pymodbus/internal/ptwisted.py", line 5, in <module> File "/usr/local/lib/python2.7/dist-packages/twisted/conch/manhole_ssh.py", line 14, in <module> from twisted.conch.ssh import factory, session File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/factory.py", line 18, in <module> from twisted.conch.ssh import (_kex, transport, userauth, connection) File "/usr/local/lib/python2.7/dist packages/twisted/conch/ssh/transport.py", line 345, in <module> class SSHTransportBase(protocol.Protocol): File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/transport.py", line 469, in SSHTransportBase supportedCiphers = _getSupportedCiphers() File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/transport.py", line 335, in _getSupportedCiphers backend=default_backend(), File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/__init__.py", line 15, in default_backend from cryptography.hazmat.backends.openssl.backend import backend File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module> from cryptography.hazmat.backends.openssl.backend import backend File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 16, in <module> from cryptography import utils, x509 File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 7, in <module> from cryptography.x509 import certificate_transparency ImportError: cannot import name certificate_transparency
-
n4m31ess_c0d3r about 6 yearsPlease add a minimal explanation in the answer itself, as the link provided may happen to unavailable in the future.