powerful-city-61287
04/03/2024, 2:13 PMPyMuPDF
python package, my app fails to start with a dynamic linking issue:
ImportError: dlopen(/Users/jake/.pex/venvs/721947db45864b75a0373c21d4d1aabf0829cb39/779eb2cc0ca9e2fdd204774cbc41848e4e7c5055/lib/python3.11/site-packages/fitz/_extra.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libmupdf.dylib
powerful-city-61287
04/03/2024, 2:14 PMpowerful-city-61287
04/03/2024, 2:14 PMpants run :dev
better-van-82973
04/03/2024, 2:17 PMPyMuPDF
. We upgraded from version 1.24.0
to version 1.24.1
and we got a pretty similar error.powerful-city-61287
04/03/2024, 2:17 PMpowerful-city-61287
04/03/2024, 2:17 PMpowerful-city-61287
04/03/2024, 2:17 PMbetter-van-82973
04/03/2024, 2:19 PMpowerful-city-61287
04/03/2024, 2:19 PM1.24.0
in my repro repo and it still fails 😕better-van-82973
04/03/2024, 2:19 PMImportError: dlopen(/Users/krishnanchandra/.pex/installed_wheels/1cb99ef55a331a5f91f1ed691a232e14fe4ef5ca2334af00100be6baf35da287/PyMuPDF-1.23.26-cp311-none-macosx_11_0_arm64.whl/fitz/_extra.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/libmupdf.dylib
Referenced from: <948BC1FA-DF38-3CE5-BAD2-8A12FE55521E> /Users/krishnanchandra/.pex/installed_wheels/1cb99ef55a331a5f91f1ed691a232e14fe4ef5ca2334af00100be6baf35da287/PyMuPDF-1.23.26-cp311-none-macosx_11_0_arm64.whl/fitz/_extra.cpython-311-darwin.so
powerful-city-61287
04/03/2024, 2:21 PMPyMuPDF
issue, a pants issue or a pex issuepowerful-city-61287
04/03/2024, 2:22 PMPyMuPDF
is doing something non-standard that pants (or the pex packager) either doesn't support or needs configuration forbetter-van-82973
04/03/2024, 2:25 PMpowerful-city-61287
04/03/2024, 2:28 PMbetter-van-82973
04/03/2024, 2:35 PMls /Users/krishnanchandra/.pex/installed_wheels/71efe8cb3e0be4a9761976b9d0fd9cdc19abd44d490dcdf572858356e7157cde/PyMuPDF-1.23.11-cp312-none-macosx_11_0_arm64.whl/fitz/
__init__.py __pycache__ _mupdf.so fitz.py table.py
__main__.py _extra.cpython-312-darwin.so extra.py mupdf.py utils.py
better-van-82973
04/03/2024, 2:36 PMls /System/Volumes/Data/Users/krishnanchandra/.pex/installed_wheels/1491c6899cc23f9e7ded9ded33c45d18c5cf9bfbe3a527968528845877dd81f3/PyMuPDFb-1.24.0-py3-none-macosx_11_0_arm64.whl/fitz/
libmupdf.dylib libmupdfcpp.so
powerful-city-61287
04/03/2024, 2:37 PMpowerful-city-61287
04/03/2024, 2:38 PMcp312
and py3
in the wheel names)better-van-82973
04/03/2024, 2:38 PMbetter-van-82973
04/03/2024, 2:40 PMpowerful-city-61287
04/03/2024, 2:41 PMpowerful-city-61287
04/03/2024, 2:42 PMNo interpreter compatible with the requested constraints was found:
Version matches CPython==3.12.1
powerful-city-61287
04/03/2024, 2:43 PMpowerful-city-61287
04/03/2024, 2:44 PMinterpreter_constraints = ["==3.12.*"]
, the build fails with the same dylib issuepowerful-city-61287
04/03/2024, 2:44 PMpowerful-city-61287
04/03/2024, 2:45 PMpowerful-city-61287
04/03/2024, 2:58 PMPyMuPDFb-1.24.0-py3-none-macosx_11_0_arm64.whl
? I don't see it here: https://pypi.org/project/PyMuPDF/1.24.0/#filespowerful-city-61287
04/03/2024, 3:00 PMbetter-van-82973
04/03/2024, 3:02 PMPyMuPDFb
(Note the lower case b at the end). That’s the binary package that PyMuPDF depends on, and where the dynamic library file comes from: https://pypi.org/project/PyMuPDFb/1.24.0/#files
It seems like the issue here is that PyMuPDFb is not being installed when it should be. One thing you could try is adding PyMuPDFb==1.24.0
as well to the requirements.txt
file and seeing if that changes things.powerful-city-61287
04/03/2024, 3:03 PMpowerful-city-61287
04/03/2024, 4:12 PMPyMuPDFb
automatically shows up in defaults.lock
, so the transitive dep seems to be configured correctly.
The linked `PyMuPDFb` wheel contains the correct dylib file.
So the issue seems to be that PyMuPDF
cannot "see" the dylib contained within its dependency PyMuPDFb
. I'm not sure how to get the PyMuPDFb
into the dlopen
search path for PyMuPDF
.powerful-city-61287
04/03/2024, 4:13 PMbetter-van-82973
04/03/2024, 4:14 PMpowerful-city-61287
04/03/2024, 4:49 PMhappy-kitchen-89482
04/09/2024, 8:49 PM