pythonstreamlitdllimport

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.


Solution

  • 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 !!!