crate-py / rpds

Python bindings to the Rust rpds crate for persistent data structures
https://rpds.readthedocs.io/
MIT License
33 stars 12 forks source link

rpds_py==0.19.0 DLL load failed on Python 3.8.0 / Windows 2008R2 #82

Closed nickolay closed 1 month ago

nickolay commented 1 month ago

rpds_py==0.19.0 DLL load failed on Python 3.8.0 / Windows 2008R2

I thought I'd share what I learned with other users on ancient systems.

0.18.1 works fine, while 0.19 raises ImportError: DLL load failed while importing rpds: The specified procedure could not be found. when importing.

The reason is missing ProcessPrng in C:\Windows\system32\bcryptprimitives.dll

Per https://github.com/rustdesk/rustdesk/discussions/7503 it's a rust issue https://github.com/rust-lang/rust/pull/121337 ; they make people compile for Windows 7 / 2008 as a separate target, which I don't think is achievable for a python library.

(py-HaCfYWJn) c:\git\py>pip install "rpds_py==0.19.0"
Collecting rpds_py==0.19.0
  Downloading rpds_py-0.19.0-cp38-none-win_amd64.whl (210 kB)
     |████████████████████████████████| 210 kB 3.3 MB/s
Installing collected packages: rpds-py
  Attempting uninstall: rpds-py
    Found existing installation: rpds-py 0.10.6
    Uninstalling rpds-py-0.10.6:
      Successfully uninstalled rpds-py-0.10.6
Successfully installed rpds-py-0.19.0

(py-HaCfYWJn) c:\git\py>python -c "import rpds"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\git\.virtualenvs\py-HaCfYWJn\lib\site-packages\rpds\__init__.py", lin
e 1, in <module>
    from .rpds import *
ImportError: DLL load failed while importing rpds: The specified procedure could not be found.

(py-HaCfYWJn) c:\git\py>pip install "rpds_py==0.18.1"
Collecting rpds_py==0.18.1
  Downloading rpds_py-0.18.1-cp38-none-win_amd64.whl (209 kB)
     |████████████████████████████████| 209 kB 2.2 MB/s
Installing collected packages: rpds-py
  Attempting uninstall: rpds-py
    Found existing installation: rpds-py 0.19.0
    Uninstalling rpds-py-0.19.0:
      Successfully uninstalled rpds-py-0.19.0
Successfully installed rpds-py-0.18.1

(py-HaCfYWJn) c:\git\py>python -c "import rpds"

dependencywalker notes:

Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.

while https://github.com/lucasg/Dependencies is more specific, pointing to C:\Windows\system32\bcryptprimitives.dll missing a ProcessPrng

dependencies
pip version: pip 21.3.1 from c:\git\.virtualenvs\py-hacfywjn\lib\site-packages\p
ip (python 3.8)
sys.version: 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 b
it (AMD64)]
FlickerSoul commented 1 month ago

Hi, this Python library is actually written in Rust. Because the wheel is compiled with the latest stable rust toolchain, the issue you saw (https://github.com/rustdesk/rustdesk/discussions/7503) should be root cause of the missing dependency, I think. If you have rust toolchain installed locally, you may be able to get around this by running pip install with --no-use-wheel flag to ignore existing compiled wheel and build the library locally. Maybe @Julian has a better solution?

Julian commented 1 month ago

I'm not sure there's anything further we could do here, we build wheels I believe for all platforms GH Actions supports on Windows, but I'm certainly happy to merge a PR adding more if not -- or if you think there's something else we can do please let us know!

Otherwise appreciate you sharing the info in case it helps anyone else!