-
Notifications
You must be signed in to change notification settings - Fork 617
Ubuntu Installation Experience
Jeremy Gillen edited this page Dec 4, 2019
·
14 revisions
MuPDF 1.14.0, PyMuPDF 1.14.0
This is a list of steps that should lead to a successfully installed PyMuPDF.
- Get the MuPDF source from the site
wget https://mupdf.com/downloads/archive/mupdf-1.14.0-source.tar.gz
and decompress it (latest version as of writing. Others available here: https://mupdf.com/downloads/archive/). - MuPDF also has a repository on GitHub. This, however, is the latest development version! Do not use it: it is probably not be compatible with the current PyMuPDF.
- Set environment variables:
export CFLAGS="-fPIC"
(on CentOS 5,export CFLAGS="-fPIC -std=gnu99"
to resolve errors about missing a definition forNAN
symbol in thethirdparty/mujs
folder). - Run the initial make:
make HAVE_X11=no HAVE_GLFW=no HAVE_GLUT=no prefix=/usr/local
- If no issues occur install:
make HAVE_X11=no HAVE_GLFW=no HAVE_GLUT=no prefix=/usr/local install
- Get the corresponding version of
PyMuPDF
:git clone -b <correct branch> https://github.com/rk700/PyMuPDF.git
(<correct branch> should matchmutool
version). - Edit the
setup.py
to point to the correct directories as indicated by the prefix used when making.
Here is the resp. code snippet:
... include_dirs=['/usr/local/include/mupdf', # we need the path of the MuPDF and zlib$ '/usr/local/thirdparty/zlib', # '/usr/include/mupdf', ], library_dirs=['/usr/local/lib'], libraries=['mupdf', #'crypto', #openssl is required by mupdf on archlinux #'jbig2dec', 'openjp2', 'jpeg', 'freetype', 'mupdf-third', # the '-' is new in v1.14.0 ], # the libraries to link with ...
(Comment unnecessary libraries out)
- Run
python setup.py build
If no exception is thrown install either with python setup.py install
or pip install
.
The following worked for me on Ubuntu 18.04.3 LTS, after having no luck with the above.
sudo -H pip3 install --upgrade pip
sudo -H python3.6 -m pip install -U pymupdf
HOWTO Button annots with JavaScript
HOWTO work with PDF embedded files
HOWTO extract text from inside rectangles
HOWTO extract text in natural reading order
HOWTO create or extract graphics
HOWTO create your own PDF Drawing
Rectangle inclusion & intersection
Metadata & bookmark maintenance