Most users on Linux, macOS or Windows with x64 systems should use
install pikepdf in their current Python environment (such as your project’s
pip install pikepdf
pip install --user pikepdf to install the package for the current user
pip install pikepdf to install to a virtual environment.
Linux users: If you have an older version of
pip, such as the one that ships
with Ubuntu 18.04, this command will attempt to compile the project instead of
installing the week. If you want to get the binary wheel, upgrade
wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py pip --version # should be 20.0 or newer pip install pikepdf
32- and 64-bit wheels are available for Windows, Linux and macOS. Binary wheels should work on most systems work on Linux distributions 2010 and newer, macOS 10.11 and newer (for Homebrew), Windows 7 and newer, provided a recent version of pip is used to install them. The Linux wheels currently include copies of libqpdf, libjpeg, and zlib The Windows wheels include libqpdf. This is to ensure that up-to-date, compatible copies of dependent libraries are included.
Currently we do not build wheels for architectures other than x86 and x64.
Alpine Linux does not support Python wheels.
Some platforms include versions of pikepdf that are distributed by the system
package manager (such as
apt). These versions may lag behind the version
distributed with PyPI, but may be convenient for users that cannot use binary
Debian, Ubuntu and other APT-based distributions¶
apt install pikepdf
dnf install python-pikepdf
apk add py3-pikepdf
Installing on FreeBSD¶
pkg install py37-pikepdf
To attempt a manual install, try something like:
pkg install python3 py37-lxml py37-pip py37-pybind11 qpdf pip install --user pikepdf
This procedure is known to work on FreeBSD 11.3, 12.0, 12.1-RELEASE and 13.0-CURRENT. It has not been tested on other versions.
Building from source¶
- a C++14 compliant compiler - GCC (5 and up), clang (3.3 and up), MSVC (2015 or newer)
- libqpdf 8.4.2 or higher from the QPDF project.
On Linux the library and headers for libqpdf must be installed because pikepdf compiles code against it and links to it.
Check Repology for QPDF to see if a recent version of QPDF is available for your platform. Otherwise you must build QPDF from source. (Consider using the binary wheels, which bundle the required version of libqpdf.)
Compiling with GCC or Clang
- clone this repository
- install libjpeg, zlib and libqpdf on your platform, including headers
pip install .
pikepdf should be built with the same compiler and linker as libqpdf; to be
precise both must use the same C++ ABI. On some platforms, setup.py may
not pick the correct compiler so one may need to set environment variables
CXX to redirect it. If the wrong compiler is selected,
import pikepdf._qpdf will throw an
ImportError about a missing
On Windows (requires Visual Studio 2015)
pikepdf requires a C++14 compliant compiler (i.e. Visual Studio 2015 on
Windows). See our continuous integration build script in
for detailed and current instructions. Or use the wheels which save this pain.
These instructions require the precompiled binary
qpdf.dll. See the QPDF
documentation if you also need to build this DLL from source. Both should be
built with the same compiler. You may not mix and match MinGW and Visual C++
Running a regular
pip install command will detect the
version of the compiler used to build Python and attempt to build the
extension with it. We must force the use of Visual Studio 2015.
Clone this repository.
In a command prompt, run:
%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x64 set DISTUTILS_USE_SDK=1 set MSSdk=1
Download qpdf-8.4.2-bin-msvc64.zip from the QPDF releases page.
bin\*.dll(all the DLLs, both QPDF’s and the Microsoft Visual C++ Runtime library) from the zip file above, and copy it to the
src/pikepdffolder in the repository.
pip install .in the root directory of the repository.
The user compiling
pikepdf to must have registry editing rights on the
machine to be able to run the
Building the documentation¶
Documentation is generated using Sphinx and you are currently reading it. To regenerate it:
pip install -r requirements/docs.txt cd pikepdf/docs make html