I wanted to import fitz in my code. To do that, I tried installing PyMuPDF using
pip3 install PyMuPDF
However, this installation fails and returns this error:
fitz/fitz_wrap.c:2754:10: fatal error: 'fitz.h' file not found
#include <fitz.h>
^~~~~~~~
1 error generated.
error: command '/opt/homebrew/clang' failed with exit code 1
I also tried installing mupdf and mupdf-tools via Homebrew. None of them could fix this issue. I would appreciate any help to fix this installation error!
Assuming you are using M1 Mac, you can solve this problem installing mupdf
, swig
, freetype
and latest version of PyMuPDF:
brew install mupdf swig freetype
pip install https://github.com/pymupdf/PyMuPDF/archive/master.tar.gz