[Cryptography-dev] Python cryptography fails to load due to _rust DDL import error

Gualtiero Scotti tierox at gmail.com
Fri Aug 4 12:29:51 EDT 2023


I m installing it from pip.and so using static wheel.
Thank you

Il Ven 4 Ago 2023, 18:28 Alex Gaynor <alex.gaynor at gmail.com> ha scritto:

> Not particularly.
>
> Based on the error message you shared, when Python attempted to import
> _rust.dll, it encountered the error "The specified module could not be
> found." I'm inferring that this means that something about the module
> could not be loaded. Perhaps _rust.dll is linked dynamically against
> another library that's not on the load path?
>
> Are you building cryptography from source, or installing from a pre-built
> wheel?
>
> Alex
>
> On Fri, Aug 4, 2023 at 12:23 PM Gualtiero Scotti <tierox at gmail.com> wrote:
> >
> > Thank you Alex for your response.  Could you provide me more details?
> Thanks in advance
> >
> > Il Ven 4 Ago 2023, 18:02 Alex Gaynor <alex.gaynor at gmail.com> ha scritto:
> >>
> >> This very likely indicates that however you've packaged and installed
> >> the application in your environment isn't properly including the
> >> extension module for cryptography.
> >>
> >> Alex
> >>
> >> On Fri, Aug 4, 2023 at 11:20 AM Gualtiero Scotti <tierox at gmail.com>
> wrote:
> >> >
> >> > I'm struggling with this issue from few days...
> >> >
> >> > I've a Python application that can run in two ways:
> >> >
> >> > Stand alone -> launched directly using the python interpreter
> >> > From a windows service -> wrapping application with pywin32 and using
> the same interpreter
> >> >
> >> > When app starts in standalone mode it works fine but when starts
> through Windows service it fails with the following stackTrace:
> >> >
> >> > .............................
> >> > from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
> >> > File "C:\Program Files
> (x86)\...\Python\Lib\site-package\cryptography\hazmat\primitives\kdf\pbkdf2.py",
> line 10, in <module>
> >> > from cryptography.exceptions import (
> >> > File "C:\Program Files
> (x86)\...\Python\Lib\site-packages\cryptography\exceptions.py", line 9, in
> <module>
> >> > from cryptography.hazmat.bindings._rust import exceptions as
> rust_exceptions
> >> > ImportError: DLL load failed while importing _rust: The specified
> module could not be found."
> >> >
> >> > I' don't know wich DLLs cryptography uses.....maybe they are not in
> librarypath???
> >> >
> >> > Python 3.11.3 32-bit
> >> > Windows 11
> >> >
> >> > Requirements.txt
> >> >
> >> > pywin32==305 pywin32-ctypes~=0.2.0 Flask~=2.1.2 flask-login~=0.6.1
> Werkzeug~=2.0.2 waitress~=2.1.2 websockets~=10.3 transitions~=0.8.11
> bitstruct~=8.15.1 PyYAML~=6.0 passlib~=1.7.4 dacite~=1.5.1 paho-mqtt~=1.6.1
> setuptools~=60.2.0 six~=1.16.0 MarkupSafe~=2.1.1 click~=8.1.3
> itsdangerous~=2.1.2 Jinja2~=3.1.2 pythonnet~=3.0.1 requests~=2.29.0
> pyserial~=3.5.0 zeep~=4.2.1 cryptography~=41.0.2 pycryptodome~=3.18.0
> >> >
> >> > Did someone have the same issue? Any suggestion is appreciated.
> >> >
> >> > Thanks in advance.
> >> >
> >> > _______________________________________________
> >> > Cryptography-dev mailing list
> >> > Cryptography-dev at python.org
> >> > https://mail.python.org/mailman/listinfo/cryptography-dev
> >>
> >>
> >>
> >> --
> >> All that is necessary for evil to succeed is for good people to do
> nothing.
> >> _______________________________________________
> >> Cryptography-dev mailing list
> >> Cryptography-dev at python.org
> >> https://mail.python.org/mailman/listinfo/cryptography-dev
> >
> > _______________________________________________
> > Cryptography-dev mailing list
> > Cryptography-dev at python.org
> > https://mail.python.org/mailman/listinfo/cryptography-dev
>
>
>
> --
> All that is necessary for evil to succeed is for good people to do nothing.
> _______________________________________________
> Cryptography-dev mailing list
> Cryptography-dev at python.org
> https://mail.python.org/mailman/listinfo/cryptography-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/cryptography-dev/attachments/20230804/6f2ca35d/attachment-0001.html>


More information about the Cryptography-dev mailing list