Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "ImportError: DLL load failed while importing _rust ..."

I am using streamlit package and I want to use streamlit_authenticator. However, I am facing the following issue:

>>> import streamlit_authenticator as stauth
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Lambda\AppData\Roaming\Python\Python310\site-packages\streamlit_authenticator\__init__.py", line 1, in <module>
    import jwt
  File "C:\Users\Lambda\AppData\Roaming\Python\Python310\site-packages\jwt\__init__.py", line 17, in <module>
    from .jwa import std_hash_by_alg
  File "C:\Users\Lambda\AppData\Roaming\Python\Python310\site-packages\jwt\jwa.py", line 26, in <module>
    from cryptography.hazmat.primitives.asymmetric import padding
  File "C:\Users\Lambda\AppData\Roaming\Python\Python310\site-packages\cryptography\hazmat\primitives\asymmetric\padding.py", line 10, in <module>
    from cryptography.hazmat.primitives import hashes
  File "C:\Users\Lambda\AppData\Roaming\Python\Python310\site-packages\cryptography\hazmat\primitives\hashes.py", line 10, in <module>
    from cryptography.hazmat.bindings._rust import openssl as rust_openssl
ImportError: DLL load failed while importing _rust: The specified module could not be found.

I searched about this kind of problem I found this discussion on github but it was not so helpful.

Specifications:

Python: 3.10.9 streamlit: 1.37.0 Windows 10

I appreciate your help and suggestions.

like image 802
Lambda Avatar asked Oct 29 '25 14:10

Lambda


2 Answers

I solved this only after installing a specific version of cryptography module, which is 41.0.7

Try to run pip install cryptography==41.0.7

link: https://forum.rasa.com/t/from-cryptography-hazmat-bindings-rust-import-importerror-dll-load-failed-while-importing-rust-the-specified-procedure-could-not-be-found/60963/6

like image 139
Asad Tariq Abbasi Avatar answered Oct 31 '25 05:10

Asad Tariq Abbasi


Well after a searching and trying blindly different solutions: apparently uninstalling and upgrading the cryptography (to version 41.0.7) and bcrypt (to version 3.2.0) packages was enough !!!

like image 32
Lambda Avatar answered Oct 31 '25 03:10

Lambda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!