pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.

Home Page:https://pymupdf.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"pip install PyMuPDF" failed. Python 3.8.0 32 bit.

conradRz opened this issue ยท comments

Describe the bug (mandatory)

-"pip install PyMuPDF" failed

To Reproduce (mandatory)

  • whether I run pip under admin or as a user, the same error occurs.

Your configuration (mandatory)

Python 3.8.0 32 bit. Windows 10 64 bit. Fitz package installed.

Additional context (optional)

Collecting PyMuPDF
  Using cached https://files.pythonhosted.org/packages/4c/8e/a84e6b205d0db6d3bd9bd4b406fb7d38548e36ed882ae3099d03b82c0ea1/PyMuPDF-1.16.8.tar.gz
Installing collected packages: PyMuPDF
    Running setup.py install for PyMuPDF ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-aqsk8wu5\\PyMuPDF\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-aqsk8wu5\\PyMuPDF\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\User\AppData\Local\Temp\pip-record-5bnq5vev\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\User\AppData\Local\Temp\pip-install-aqsk8wu5\PyMuPDF\
    Complete output (19 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.8
    creating build\lib.win32-3.8\fitz
    copying fitz\__init__.py -> build\lib.win32-3.8\fitz
    copying fitz\fitz.py -> build\lib.win32-3.8\fitz
    copying fitz\utils.py -> build\lib.win32-3.8\fitz
    copying fitz\__main__.py -> build\lib.win32-3.8\fitz
    running build_ext
    building 'fitz._fitz' extension
    creating build\temp.win32-3.8
    creating build\temp.win32-3.8\Release
    creating build\temp.win32-3.8\Release\fitz
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I./mupdf/include -I./mupdf/include/mupdf "-Ic:\program files (x86)\python38-32\include" "-Ic:\program files (x86)\python38-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tc./fitz/fitz_wrap.c /Fobuild\temp.win32-3.8\Release\./fitz/fitz_wrap.obj
    fitz_wrap.c
    ./fitz/fitz_wrap.c(2732): fatal error C1083: Cannot open include file: 'fitz.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.20.27508\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-aqsk8wu5\\PyMuPDF\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-aqsk8wu5\\PyMuPDF\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\User\AppData\Local\Temp\pip-record-5bnq5vev\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

pip install PyMuPDF==1.16.7 worked, but the default one and latest didn't

pip search MuPDF
PyMuPDF (1.16.8)  - Python bindings for the PDF rendering library MuPDF
  INSTALLED: 1.16.7
  LATEST:    1.16.8

The reason is: I have not created 32-bit wheels - as I previously did.
The 64bit version should work.
If PIP does not find find a fitting wheel for your system, it will start generating from sources ... which in our case will fail, because MuPDF will most certainly not have been installed.

Thanks for looking into this.

Uff, that was a quick close ๐Ÿ˜ฎ
No problem for you using 64bit?
My (internal) reasoning for dropping the 32bit Windows wheels was driven by two aspects:

  • reduce network traffic (I have a low bandwidth internet connection)
  • more justice with the non-Windows guys, who never have seen a 32bit wheel version
commented

Hi is there any plan to change in the future? I was just curious. I ran into the same error today and used the solution proposed and it seems to work. I just wanted to know in case we use this tool in the future.

Yes, starting with the next version, I will again upload 32bit wheels.
If you need one now as a quick solution, drop me a note please.

Hi,
I've been facing the a similar issue when installing PyMuPDF on my raspberry Pi. I've been trying work this out for more than a week. Just to highlight, I'm a beginner on coding and linux.

Firstly when I ran "pip install PyMuPDF" I got the error bellow:
"command 'arm-linux-gnueabihf-gcc' failed with exit status 1"
The same error happened with I downloaded and tried to install PyMuPDF-master by "python setup.py install"

After several unsuccessful tries and errors installing all sorts of packages when I ran "python setup.py install" from PyMuPDF-master I got a slightly different error:
"error: command 'gcc' failed with exit status 1"

I did all the steps on the links bellow, but nothing worked.
https://solarianprogrammer.com/2018/05/06/building-gcc-cross-compiler-raspberry-pi/
https://github.com/Pro/raspi-toolchain

Appreciate any help on this.

I encountered the same issue today on Windows 10 (64 bits). Installing with: pip install PyMuPDF==1.16.7 as suggested by @conradOU did the trick though.

Error is: fitz/fitz_wrap.c(2755): fatal error C1083: Impossible d'ouvrir le fichier includeรฟ: 'fitz.h'รฟ: No such file or directory

Complete error message:

>pip install PyMuPDF
Collecting PyMuPDF
  Downloading PyMuPDF-1.19.6.tar.gz (2.3 MB)
     |โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 2.3 MB 3.3 MB/s
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: PyMuPDF
  Building wheel for PyMuPDF (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\ProgramData\Anaconda3\envs\sisr\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-zm7rmtay\\pymupdf_28f652253f8343bc9977d329e2eabc5a\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-zm7rmtay\\pymupdf_28f652253f8343bc9977d329e2eabc5a\\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 'C:\Users\XXX\AppData\Local\Temp\pip-wheel-zituhdbr'
       cwd: C:\Users\XXX\AppData\Local\Temp\pip-install-zm7rmtay\pymupdf_28f652253f8343bc9977d329e2eabc5a\
  Complete output (19 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.6
  creating build\lib.win-amd64-3.6\fitz
  copying fitz\__init__.py -> build\lib.win-amd64-3.6\fitz
  copying fitz\fitz.py -> build\lib.win-amd64-3.6\fitz
  copying fitz\utils.py -> build\lib.win-amd64-3.6\fitz
  copying fitz\__main__.py -> build\lib.win-amd64-3.6\fitz
  running build_ext
  building 'fitz._fitz' extension
  creating build\temp.win-amd64-3.6
  creating build\temp.win-amd64-3.6\Release
  creating build\temp.win-amd64-3.6\Release\fitz
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I./mupdf/include -I./mupdf/include/mupdf -I./mupdf/thirdparty/freetype/include -IC:\ProgramData\Anaconda3\envs\sisr\include -IC:\ProgramData\Anaconda3\envs\sisr\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcfitz/fitz_wrap.c /Fobuild\temp.win-amd64-3.6\Release\fitz/fitz_wrap.obj
  fitz_wrap.c
  fitz/fitz_wrap.c(2755): fatal error C1083: Impossible d'ouvrir le fichier includeรฟ: 'fitz.h'รฟ: No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
  ----------------------------------------
  ERROR: Failed building wheel for PyMuPDF
  Running setup.py clean for PyMuPDF
Failed to build PyMuPDF
Installing collected packages: PyMuPDF
    Running setup.py install for PyMuPDF ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\ProgramData\Anaconda3\envs\sisr\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-zm7rmtay\\pymupdf_28f652253f8343bc9977d329e2eabc5a\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-zm7rmtay\\pymupdf_28f652253f8343bc9977d329e2eabc5a\\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 'C:\Users\XXX\AppData\Local\Temp\pip-record-t9w9ajgr\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\ProgramData\Anaconda3\envs\sisr\Include\PyMuPDF'
         cwd: C:\Users\XXX\AppData\Local\Temp\pip-install-zm7rmtay\pymupdf_28f652253f8343bc9977d329e2eabc5a\
    Complete output (19 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.6
    creating build\lib.win-amd64-3.6\fitz
    copying fitz\__init__.py -> build\lib.win-amd64-3.6\fitz
    copying fitz\fitz.py -> build\lib.win-amd64-3.6\fitz
    copying fitz\utils.py -> build\lib.win-amd64-3.6\fitz
    copying fitz\__main__.py -> build\lib.win-amd64-3.6\fitz
    running build_ext
    building 'fitz._fitz' extension
    creating build\temp.win-amd64-3.6
    creating build\temp.win-amd64-3.6\Release
    creating build\temp.win-amd64-3.6\Release\fitz
    C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I./mupdf/include -I./mupdf/include/mupdf -I./mupdf/thirdparty/freetype/include -IC:\ProgramData\Anaconda3\envs\sisr\include -IC:\ProgramData\Anaconda3\envs\sisr\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcfitz/fitz_wrap.c /Fobuild\temp.win-amd64-3.6\Release\fitz/fitz_wrap.obj
    fitz_wrap.c
    fitz/fitz_wrap.c(2755): fatal error C1083: Impossible d'ouvrir le fichier includeรฟ: 'fitz.h'รฟ: No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\envs\sisr\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-zm7rmtay\\pymupdf_28f652253f8343bc9977d329e2eabc5a\\setup.py'"'"'; __file__='"'"'C:\\Users\\XXX\\AppData\\Local\\Temp\\pip-install-zm7rmtay\\pymupdf_28f652253f8343bc9977d329e2eabc5a\\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 'C:\Users\XXX\AppData\Local\Temp\pip-record-t9w9ajgr\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\ProgramData\Anaconda3\envs\sisr\Include\PyMuPDF' Check the logs for full command output.

It is kind of weird that it seeks Visual Studio in the 32bits Program Files though. As one would expect, I did not install MuPDF, as it states here that "[New in PyMuPDF-1.20: there is no need to separately build or install MuPDF; the required MuPDF source code is already in the sdist and is automatically built into PyMuPDF.]".

EDIT: it seems that my pip is not collecting the 1.20 version but the 1.19, although I ran python -m pip install --upgrade pip beforehand. Maybe since the 1.20 version was released today I need to wait a bit longer?

Python 3.6 is out of its lifespan and hence no longer supported with a wheel. Therefore pip will always try to install from sources.
Which may be bound to fail, because Python C methods might be used that did not exist prior to Python 3.7.
So please upgrade your zombie Python by at least one version and your are fine.

@JorjMcKie Thank you very much for the quick answer. Indeed, my bad, I was trying this on my personal windows computer, which I almost never use for programming, I didn't even notice that my Python was that old xD

I should have read PyMuPDF installation page more thoroughly : "PyMuPDF does not support Python versions prior to 3.7".

No problem at all.
Would be great if everything could be solved that easily ๐Ÿ˜‰.