Cryptography: AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_CMS'

Created on 7 Apr 2018  路  7Comments  路  Source: pyca/cryptography

I was using cryptography 2.2.2 and got this error.
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_CMS'

I downgraded to cryptography 2.2.1 and I don't have the error anymore.

Here is the full error report:

    from oauth2client import client, tools
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\client.py", line 45, in <module>
    from oauth2client import crypt
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\crypt.py", line 45, in <module>
    from oauth2client import _openssl_crypt
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\_openssl_crypt.py", line 16, in <module>
    from OpenSSL import crypto
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenSSL\crypto.py", line 16, in <module>
    from OpenSSL._util import (
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 156, in <module>
    Binding.init_static_locks()
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 137, in init_static_locks
    cls._ensure_ffi_initialized()
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 124, in _ensure_ffi_initialized
    cls.lib = build_conditional_library(lib, CONDITIONAL_NAuserS)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 84, in build_conditional_library
    if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_CMS'
  • Versions of:
  • Python==3.6.5,
  • cryptography==2.2.2
  • cffi==1.11.5,
  • pip==9.0.3`
  • setuptools: not installed
installation

Most helpful comment

Can you try uninstalling cryptography and reinstalling? It looks like somehow you've got a .so and a Python library of differeing versions.

All 7 comments

Can you try uninstalling cryptography and reinstalling? It looks like somehow you've got a .so and a Python library of differeing versions.

I have uninstalled cryptography and reinstalled it as you asked. The version I have now is 2.2.2 and I don't get the error anymore. So it may be what you suggested.

Sorry for opening an issue for that.

I got this error:

 File "/home/ies/.local/lib/python3.5/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 85, in build_conditional_library
    if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_GENERIC_DTLS_METHOD'

@Allan-Nava uninstall cryptography bundle and reinstall it. There is a conflict somewhere, you might be using some more than one libraries with different versions of cryptography. Its better to use conda for separate versions.

@harsh23tyagi I solved with specific version of openssl etc, thanks!

I have found a solution as uninstall openssl or azure library, restart cluster and install it again, but restarting cluster may not be possible because it may need to handle longer tasks, etc.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

reaperhulk picture reaperhulk  路  22Comments

chitoge picture chitoge  路  26Comments

glyph picture glyph  路  46Comments

TrollNation picture TrollNation  路  20Comments

abhishek-ram picture abhishek-ram  路  37Comments