Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Support building docker image from M1 Mac #1562

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

Closed
NixBiks opened this issue Jan 27, 2022 · 1 comment
Closed

Support building docker image from M1 Mac #1562

NixBiks opened this issue Jan 27, 2022 · 1 comment
Assignees
Labels
enhancement wontfix no intention to resolve

Comments

@NixBiks
Copy link

NixBiks commented Jan 27, 2022

Is your feature request related to a problem? Please describe.

I'm trying to build a docker container with PyMuPDF but unfortunately I can't get it to work on my Mac M1.

Describe the solution you'd like

My Dockerfile looks like this

FROM python:3.10-bullseye
RUN apt-get update && apt-get install --no-install-recommends -y mupdf
RUN pip3 install --upgrade pip
RUN pip3 install pymupdf

When I run docker build . then I get the following error

#7 0.558 Collecting pymupdf                                                                                                                                            
#7 0.750   Downloading PyMuPDF-1.19.4.tar.gz (2.3 MB)                                                                                                                  
#7 0.955   Preparing metadata (setup.py): started                                                                                                                      
#7 1.134   Preparing metadata (setup.py): finished with status 'done'                                                                                                  
#7 1.135 Building wheels for collected packages: pymupdf
#7 1.136   Building wheel for pymupdf (setup.py): started
#7 1.294   Building wheel for pymupdf (setup.py): finished with status 'error'
#7 1.294   ERROR: Command errored out with exit status 1:
#7 1.294    command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-rdtyj0dj
#7 1.294        cwd: /tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/
#7 1.294   Complete output (20 lines):
#7 1.294   running bdist_wheel
#7 1.294   running build
#7 1.294   running build_py
#7 1.294   creating build
#7 1.294   creating build/lib.linux-aarch64-3.10
#7 1.294   creating build/lib.linux-aarch64-3.10/fitz
#7 1.294   copying fitz/__init__.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.294   copying fitz/fitz.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.294   copying fitz/utils.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.294   copying fitz/__main__.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.294   running build_ext
#7 1.294   building 'fitz._fitz' extension
#7 1.294   creating build/temp.linux-aarch64-3.10
#7 1.294   creating build/temp.linux-aarch64-3.10/fitz
#7 1.294   gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/freetype2 -I/usr/local/include/python3.10 -c fitz/fitz_wrap.c -o build/temp.linux-aarch64-3.10/fitz/fitz_wrap.o
#7 1.294   fitz/fitz_wrap.c:2755:10: fatal error: fitz.h: No such file or directory
#7 1.294    2755 | #include <fitz.h>
#7 1.294         |          ^~~~~~~~
#7 1.294   compilation terminated.
#7 1.294   error: command '/usr/bin/gcc' failed with exit code 1
#7 1.294   ----------------------------------------
#7 1.294   ERROR: Failed building wheel for pymupdf
#7 1.294   Running setup.py clean for pymupdf
#7 1.375 Failed to build pymupdf
#7 1.386 Installing collected packages: pymupdf
#7 1.387     Running setup.py install for pymupdf: started
#7 1.517     ERROR: Command errored out with exit status 1:
#7 1.517      command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-h77owsa2/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.10/pymupdf
#7 1.517          cwd: /tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/
#7 1.517     Complete output (20 lines):
#7 1.517     running install
#7 1.517     running build
#7 1.517     running build_py
#7 1.517     creating build
#7 1.517     creating build/lib.linux-aarch64-3.10
#7 1.517     creating build/lib.linux-aarch64-3.10/fitz
#7 1.517     copying fitz/__init__.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.517     copying fitz/fitz.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.517     copying fitz/utils.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.517     copying fitz/__main__.py -> build/lib.linux-aarch64-3.10/fitz
#7 1.517     running build_ext
#7 1.517     building 'fitz._fitz' extension
#7 1.517     creating build/temp.linux-aarch64-3.10
#7 1.517     creating build/temp.linux-aarch64-3.10/fitz
#7 1.517     gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -Imupdf/thirdparty/freetype/include -I/usr/include/freetype2 -I/usr/local/include/python3.10 -c fitz/fitz_wrap.c -o build/temp.linux-aarch64-3.10/fitz/fitz_wrap.o
#7 1.517     fitz/fitz_wrap.c:2755:10: fatal error: fitz.h: No such file or directory
#7 1.517      2755 | #include <fitz.h>
#7 1.517           |          ^~~~~~~~
#7 1.517     compilation terminated.
#7 1.517     error: command '/usr/bin/gcc' failed with exit code 1
#7 1.517     ----------------------------------------
#7 1.517     Running setup.py install for pymupdf: finished with status 'error'
#7 1.517 ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7ttde7if/pymupdf_5e778e7ede114e88a541cb42ff556098/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-h77owsa2/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.10/pymupdf Check the logs for full command output.

Additional context
I've also questioned this in this closed thread but I thought it was better to start a new issue instead.

@JorjMcKie
Copy link
Collaborator

I cannot help you here. I have no Mac machine and also no M1.
The CI service of Github only supports Mac on Intel servers, and does not support docker services in this case.
Your error is fairly typical for building from sources: it always occurs when setup.py cannot find the libraries of the installed MuPDF.
There also has been quite some discussion going on about M1 support here. I will turn this issue into a discussion and put it close to those other comments.

You are more than welcome to develop something that can help other M1 users to more easily install PyMuPDF.

@JorjMcKie JorjMcKie added the wontfix no intention to resolve label Jan 27, 2022
@pymupdf pymupdf locked and limited conversation to collaborators Jan 27, 2022
@JorjMcKie JorjMcKie converted this issue into discussion #1563 Jan 27, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement wontfix no intention to resolve
Projects
None yet
Development

No branches or pull requests

2 participants