pyca / cryptography

cryptography is a package designed to expose cryptographic primitives and recipes to Python developers.
https://cryptography.io
Other
6.67k stars 1.53k forks source link

Django DRF error DLL Load Failed while importing _rust in Python 3.11.3 venv in Windows Server 2022 with cryptography-43.0.1-cp39-abi3-win_amd64.whl #11587

Closed alinganpatra20004 closed 1 month ago

alinganpatra20004 commented 1 month ago

My code is working in local environment of windows10 with venv on Python 3.10.11. However, on deploying in Windows Server 2022 with Apache2 webserver with venv on Python 3.11.3 getting following error. I have trying upgrading, installing binary. Till now issue is not resolved. Can anyone help in getting the issue resolved?

other packages in problematic environment are cffi-1.17.1 cryptography-43.0.1 pycparser-2.22

from cryptography.hazmat.primitives.asymmetric import padding\r
  File "C:\\cbsesb\\cbsenv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\asymmetric\\padding.py", line 9, in <module>\r
    from cryptography.hazmat.primitives import hashes\r
  File "C:\\cbsesb\\cbsenv\\Lib\\site-packages\\cryptography\\hazmat\\primitives\\hashes.py", line 9, in <module>\r
    from cryptography.hazmat.bindings._rust import openssl as rust_openssl\r
ImportError: DLL load failed while importing _rust: The specified module could not be found.\r
Package                 Version
----------------------- ---------
asgiref                 3.7.1
certifi                 2023.7.22
cffi                    1.17.1
charset-normalizer      3.3.2
cryptography            43.0.1
cx-Oracle               8.3.0
defusedxml              0.7.1
dicttoxml               1.7.16
Django                  4.2.1
djangorestframework     3.14.0
djangorestframework-xml 2.0.0
idna                    3.6
ldap3                   2.9.1
lxml                    4.9.3
mod-wsgi                4.9.4
pip                     24.2
psycopg2                2.9.6
pyasn1                  0.6.0
pycparser               2.22
pycryptodome            3.18.0
pyOpenSSL               24.2.1
pytz                    2023.3
requests                2.31.0
setuptools              74.1.2
signxml                 3.2.1
soupsieve               2.5
sqlparse                0.4.4
typing_extensions       4.6.1
tzdata                  2023.3
urllib3                 2.2.0
xmltodict               0.12.0

Tried to update the setup tools but did not worked

python -m pip install --upgrade pip setuptools

Tried to downgrade the Python to 3.10 but did not worked.

installing Rust doesn't work.

Tried installing binary for cryptography but did not worked.

python -m pip install cryptography --only-binary cryptography

alex commented 1 month ago

I'm not familiar with this error, however some Googling suggests other people resolved similar errors by installing https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

alinganpatra20004 commented 1 month ago

I'm not familiar with this error, however some Googling suggests other people resolved similar errors by installing https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

@alex , Thanks for suggesting this approach. However, the issue has not been resolved even after installing the latest Microsoft Visual C++ version, 2015-2022. I am getting the same error.

github-actions[bot] commented 1 month ago

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

github-actions[bot] commented 1 month ago

This issue has not received a reporter response and has been auto-closed. If the issue is still relevant please leave a comment and we can reopen it.