How to Install PyPDF2 in Python

v3.0.1 General Purpose Python >=3.6

A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files

Install pip install PyPDF2

What is PyPDF2?

A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files

NOTE: The PyPDF2 project is going back to its roots. PyPDF2==3.0.X will be the last version of PyPDF2. Development will continue with .

PyPDF2 is a free and open-source pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files. It can also add custom data, viewing options, and passwords to PDF files. PyPDF2 can retrieve text and metadata from PDFs as well.

If you plan to use PyPDF2 for encrypting or decrypting PDFs that use AES, you will need to install some extra dependencies. Encryption using RC4 is supported using the regular installation.

Quick Start

Minimal example to get started with PyPDF2:

import PyPDF2

print(PyPDF2.__version__)

Installation

pip (standard)

pip install PyPDF2

Virtual environment (recommended)

python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install PyPDF2

pip3

pip3 install PyPDF2

conda

conda install -c conda-forge PyPDF2

Poetry

poetry add PyPDF2

Dependencies

Installing PyPDF2 will also install these packages:

Verify the Installation

After installing, confirm the package is available:

python -c "import PyPDF2; print(PyPDF2.__version__)"

If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.

Installation Errors

Common errors when installing PyPDF2 with pip.

ModuleNotFoundError: No module named 'PyPDF2'

Cause: The package is not installed in the current Python environment.

Fix: Run pip install PyPDF2. If using a virtual environment, ensure it is activated first.

ModuleNotFoundError: No module named 'PyPDF2' (installed but still failing)

Cause: pip installed the package into a different Python than the one running your script.

Fix: Use python -m pip install PyPDF2 to install into the interpreter you are running.

ImportError: cannot import name 'X' from 'PyPDF2'

Cause: The function or class does not exist in the installed version.

Fix: Check the version with pip show PyPDF2 and upgrade with pip install --upgrade PyPDF2.

pip: command not found

Cause: pip is not in PATH or Python was not added to PATH during installation.

Fix: Try python -m pip install PyPDF2. On macOS/Linux try pip3.

PermissionError: [Errno 13] Permission denied

Cause: No write access to the system Python package directory.

Fix: Use a virtual environment, or add --user: pip install --user PyPDF2

SSL: CERTIFICATE_VERIFY_FAILED

Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.

Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org PyPDF2

Recent Releases

VersionReleased
3.0.1 latest 2022-12-31
3.0.0 2022-12-22
2.12.0 2022-12-10
2.12.1 2022-12-10
2.11.2 2022-11-20

Full release history on PyPI →

Manage PyPDF2

Upgrade to latest version

pip install --upgrade PyPDF2

Install a specific version

pip install PyPDF2==3.0.1

Uninstall

pip uninstall PyPDF2

Check what is installed

pip show PyPDF2

Last updated: 2026-04-11 • Data from PyPI