miurahr / py7zr

7zip in python3 with ZStandard, PPMd, LZMA2, LZMA1, Delta, BCJ, BZip2, and Deflate compressions, and AES encryption.

Home Page:https://pypi.org/project/py7zr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py7zr fail to load on azure vm, because dependency brotli failed to load brotli DLL

yannou38 opened this issue · comments

Describe the bug

On an Azure VM, py7zr couldn't load due to the brotlicffi module missing

Related issue
Found while looking at this issue.

To Reproduce
Unsure. Try to install py7zr on a newly created azure VM and call "python -m py7zr i" could trigger the error ?

Expected behavior

Environment (please complete the following information):

  • OS: Azure VM Windows
  • Python 3.11.1
  • py7zr version: 0.20.5

Additional context
Additional context can be found in linked issue

brotlicffi is dependency for pypy, but you use CPython and log show a successful install of Brotli library.
It seems a problem where importing brotli library.

From traceback, a problem is as follows:

Traceback (most recent call last):
  File "C:\ghr\IOTSEC-gh-actions\1\_work\setup-qt\setup-qt\.venv\Lib\site-packages\py7zr\compressor.py", line 67, in <module>
    import brotli  # type: ignore  # noqa
    ^^^^^^^^^^^^^
  File "C:\ghr\IOTSEC-gh-actions\1\_work\setup-qt\setup-qt\.venv\Lib\site-packages\brotli.py", line 8, in <module>
    import _brotli
ImportError: DLL load failed while importing _brotli: The specified module could not be found.

It shows the error is happened in brotli.py from brotli library to fail loading _blotli.dll.

Latest CI test is passed with brotli 1.0.9 on Python 3.11.4 on Windows in 3 weeks ago.
brotli 1.0.9 is latest version.

There is a similar bug issue in brotli project.
google/brotli#782 (comment)

said

Maybe you're system is missing the visual c++ redistributable DLLs (though I think python itself should come with one).
You said 64-bit, try to install the current "vc_redist.x64.exe" from this link
https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

@yannou38 does #543 solve your issue?

I'm sorry but i'm unable to reproduce the error. I had changed my CI to install brotlicffi manually so that the brotli failure would fall back on it, but uninstalling this module and trying again to install qt seem to works on the azure VM, and i'm not sure why (I don't have manual access to this VM, we may have installed the c++ redis for example) and i can't see if there's an error message.

However, i took a look at the PR and it seems good, so thanks for the work !