Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during build in python:3.12-alpine on Apple Silicon #3743

Closed
simepy opened this issue Jul 30, 2024 · 2 comments
Closed

Error during build in python:3.12-alpine on Apple Silicon #3743

simepy opened this issue Jul 30, 2024 · 2 comments

Comments

@simepy
Copy link

simepy commented Jul 30, 2024

Description of the bug

Hello,
I tried to install pymyPDF in the image python:3.12-alpine but, I run into an error during the build

This is the log:

0.523 Collecting pymupdf (from -r requirements.txt (line 3))
0.534   Downloading PyMuPDF-1.24.9.tar.gz (33.0 MB)
1.168      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 33.0/33.0 MB 55.5 MB/s eta 0:00:00
1.407   Getting requirements to build wheel: started
1.460   Getting requirements to build wheel: finished with status 'done'
1.461   Installing backend dependencies: started
2.913   Installing backend dependencies: finished with status 'done'
2.913   Preparing metadata (pyproject.toml): started
7.647   Preparing metadata (pyproject.toml): finished with status 'error'
7.651   error: subprocess-exited-with-error
7.651
7.651   × Preparing metadata (pyproject.toml) did not run successfully.
7.651   │ exit code: 1
7.651   ╰─> [73 lines of output]
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: ### Starting.
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: __name__: 'setup'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: platform.platform(): 'Linux-6.10.0-linuxkit-aarch64-with'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: platform.python_version(): '3.12.4'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: sys.executable: '/usr/local/bin/python'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: CPU bits: 64 sys.maxsize=9223372036854775807
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: __file__: '/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: os.getcwd(): '/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: sys.argv (3):
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     0: '/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     1: 'prepare_metadata_for_build_wheel'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     2: '/tmp/tmpv36wra_h'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: os.environ (15):
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     GPG_KEY: '7169605F62C751356D054A26A821E680E5FA6305'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     HOME: '/root'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     LANG: 'C.UTF-8'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PATH: '/tmp/pip-build-env-2pncg7gt/overlay/bin:/tmp/pip-build-env-2pncg7gt/normal/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PEP517_BACKEND_PATH: '/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PEP517_BUILD_BACKEND: 'setup'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PIP_BUILD_TRACKER: '/tmp/pip-build-tracker-rzc21qrs'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PWD: '/usr/share/app'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PYTHONNOUSERSITE: '1'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PYTHONPATH: '/tmp/pip-build-env-2pncg7gt/site'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PYTHON_GET_PIP_SHA256: 'ee09098395e42eb1f82ef4acb231a767a6ae85504a9cf9983223df0a7cbd35d7'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PYTHON_GET_PIP_URL: 'https://github.com/pypa/get-pip/raw/e03e1607ad60522cf34a92e834138eb89f57667c/public/get-pip.py'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PYTHON_PIP_VERSION: '24.0'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     PYTHON_VERSION: '3.12.4'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py:     SHLVL: '1'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: get_mupdf_internal(): out='dir' location=None sha=None
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: Download location='https://mupdf.com/downloads/archive/mupdf-1.24.8-source.tar.gz' local_tgz='mupdf-1.24.8-source.tar.gz' name='mupdf-1.24.8-source'
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: Downloading from location='https://mupdf.com/downloads/archive/mupdf-1.24.8-source.tar.gz' to local_tgz='mupdf-1.24.8-source.tar.gz'.
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: Extracting mupdf-1.24.8-source.tar.gz
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: Setting XCFLAGS and XCXXFLAGS to predefine TOFU_CJK_EXT.
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: Appending `bsymbolic-` to MuPDF build path.
7.651       pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py: Building MuPDF by running: cd /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source && XCFLAGS=-DTOFU_CJK_EXT XCXXFLAGS=-DTOFU_CJK_EXT /usr/local/bin/python ./scripts/mupdfwrap.py -d build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release -b all && echo /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source/build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release: && ls -l /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source/build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release
7.651       (+0.1s): -b: m: __main__.py:1617:build: Building libmupdf.so ...
7.651       (+0.1s): -b: m: __main__.py:1218:_get_m_command: Setting -j to  multiprocessing.cpu_count()=12
7.651       (+0.1s): -b: m: __main__.py:1619:build: running: cd /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source && XLIB_LDFLAGS=-Wl,-Bsymbolic make -j 12 HAVE_GLUT=no HAVE_PTHREAD=yes verbose=yes shared=yes HAVE_LEPTONICA=yes HAVE_TESSERACT=yes build=release build_prefix=PyMuPDF-aarch64-shared-tesseract-bsymbolic-
7.651       (+0.1s): -b: m: __main__.py:1619:build: (+0.1s): -b: m: __main__.py:1619:build: /bin/sh: make: not found
7.651       (+0.1s): -b: m: __main__.py:1619:build: (+0.1s): -b: m: __main__.py:1619:build:
7.651       (+0.1s): -b: m: __main__.py:1619:build: [returned e=127]
7.651       Traceback (most recent call last):
7.651           scripts/mupdfwrap.py:6:<module>(): wrap.__main__.main()
7.651           scripts/wrap/__main__.py:3062:main(): jlib.exception_info()
7.651           ^except raise:
7.651           scripts/wrap/__main__.py:3060:main(): main2()
7.651           scripts/wrap/__main__.py:2445:main2(): build( build_dirs, swig_command, args, vs_upgrade, make_command)
7.651           scripts/wrap/__main__.py:1619:build(): jlib.system( command, prefix=jlib.log_text(), out='log', verbose=1)
7.651           scripts/jlib.py:1700:system(): raise Exception( message)
7.651       Exception: Command failed: cd /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source && XLIB_LDFLAGS=-Wl,-Bsymbolic make -j 12 HAVE_GLUT=no HAVE_PTHREAD=yes verbose=yes shared=yes HAVE_LEPTONICA=yes HAVE_TESSERACT=yes build=release build_prefix=PyMuPDF-aarch64-shared-tesseract-bsymbolic-
7.651       Traceback (most recent call last):
7.651         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
7.651           main()
7.651         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
7.651           json_out['return_val'] = hook(**hook_input['kwargs'])
7.651                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7.651         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
7.651           whl_basename = backend.build_wheel(metadata_directory, config_settings)
7.651                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7.651         File "/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/pipcl.py", line 639, in build_wheel
7.651           items = self._call_fn_build(config_settings)
7.651                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7.651         File "/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/pipcl.py", line 809, in _call_fn_build
7.651           ret = self.fn_build()
7.651                 ^^^^^^^^^^^^^^^
7.651         File "/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py", line 541, in build
7.651           mupdf_build_dir = build_mupdf_unix( mupdf_local, build_type, overwrite_config)
7.651                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7.651         File "/tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/setup.py", line 852, in build_mupdf_unix
7.651           subprocess.run( command, shell=True, check=True)
7.651         File "/usr/local/lib/python3.12/subprocess.py", line 571, in run
7.651           raise CalledProcessError(retcode, process.args,
7.651       subprocess.CalledProcessError: Command 'cd /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source && XCFLAGS=-DTOFU_CJK_EXT XCXXFLAGS=-DTOFU_CJK_EXT /usr/local/bin/python ./scripts/mupdfwrap.py -d build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release -b all && echo /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source/build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release: && ls -l /tmp/pip-install-_ni49x_p/pymupdf_f68f1de610e84bb69e89c1fe86e7ca4d/mupdf-1.24.8-source/build/PyMuPDF-aarch64-shared-tesseract-bsymbolic-release' returned non-zero exit status 1.
7.651       [end of output]

How to reproduce the bug

Build this Dockerfile on Apple Silicon :

FROM python:3.12-alpine

RUN apk add gcc musl-dev
RUN pip install pip --no-cache-dir && pip install pymupdf --no-cache-dir

Note: It's working if I install it with pip directly on the system

System:
MacOS 14.5, M3 Pro

Expected : build correctly

Maybe related to : #3541

PyMuPDF version

1.24.9

Operating system

MacOS

Python version

3.12

@simepy simepy changed the title Error during build python:3.12-alpine on Apple Silicon Error during build in python:3.12-alpine on Apple Silicon Jul 30, 2024
@julian-smith-artifex-com
Copy link
Collaborator

Wheels for Linux/ARM were missing on pypi.org until a few days ago. So i suspect your pip was trying to build from source, but failed because you don't have development tools installed (specifically make).

I think it should work if you try again. Please let us know how you get on.

@julian-smith-artifex-com
Copy link
Collaborator

Note that PyMuPDF is not supported on Linux / aarch64 / musl libc - we do not provide wheels, and the build fails.

So i'll close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants