1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python: ImportError: DLL load failed while importing _rust: The specified module...

Discussão em 'Python' iniciado por Stack, Setembro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I'm getting that error any time that the following is executed from a Python script:

    from cryptography.hazmat.bindings._rust import <whatever>


    I look at the file structure for my ...\site-packages\cryptography\hazmat\bindings and see:

    <DIR> __pycache__
    <DIR> _rust
    <DIR> openssl
    __init__.py
    _rust.pyd


    So, there is a _rust directory, but no _rust.py file. Is the _rust folder the _rust python module? Or am I missing the _rust module?

    In that _rust folder there is a __init__.pyi file. I try doing:

    import cryptography.hazmat.bindings._rust.__init__.pyi


    and obtain the same "DLL load failed while importing _rust" error.

    Google AI tells me:


    The "DLL load failed while importing _rust" error, often seen in Python when trying to import cryptography.hazmat.bindings._rust, indicates that the Python interpreter cannot find the necessary shared library (.dll on Windows, .so on Linux, .dylib on macOS) for the _rust module.
    ​

    Which is the Windows DLL that cannot be found? Is it part of Rust? I have rustup installed, and the ".cargo\bin" folder is in the PATH. But that folder does not contain any dll, only executables.

    I am using Python 3.12.9

    My packages are up to date:

    python -m pip list -v

    Package Version Location Installer
    ------------------ --------- ----------------------------------------- ---------
    bcrypt 4.3.0 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    certifi 2025.6.15 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    cffi 2.0.0 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    charset-normalizer 3.4.2 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    colorama 0.4.6 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    cryptography 45.0.7 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    idna 3.10 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    pdfminer.six 20250506 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    pip 25.2 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    pycparser 2.23 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    requests 2.32.4 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    six 1.17.0 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    srt 3.5.3 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    tqdm 4.67.1 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    urllib3 2.5.0 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    vosk 0.3.45 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip
    websockets 15.0.1 C:\DEV\DEV_TOOLS\Python\Lib\site-packages pip


    I have reinstalled Microsoft Visual C++ Redistributable.

    Continue reading...

Compartilhe esta Página