Last modified: Oct 06, 2026
Install pdfplumber in Python: A Simple Guide
pdfplumber is a powerful Python library for extracting text, tables, and shapes from PDF files. It works best on machine-generated PDFs. This guide shows you how to install it correctly on any operating system.
The installation is simple, but beginners often hit small issues. You will learn the right commands, how to verify the install, and how to fix common errors.
What Is pdfplumber?
pdfplumber is a Python package that lets you read detailed information from PDF documents. It can pull out every character, rectangle, and line. You can also extract tables with high accuracy.
The library is built on top of pdfminer.six. It is tested on Python 3.10 through 3.14, so make sure your Python version is not too old[reference:0].
It is designed for machine-generated PDFs, not scanned images. If you need to read scanned documents, you will also need an OCR tool.
Why Install pdfplumber?
Many Python PDF tools only give you plain text. pdfplumber gives you layout details. That means you can keep the original structure of the document.
It is especially useful for:
- Extracting tables into structured data.
- Reading text with precise positions.
- Debugging PDF layouts visually.
If you work with reports, invoices, or research papers, pdfplumber saves you hours of manual copy-pasting.
Prerequisites Before You Install
Before running the install command, check two things. First, confirm Python is installed. Second, make sure pip is available.
Open your terminal or command prompt and run:
python --version
pip --version
You should see a Python version like 3.10 or higher. If you see an error, install Python from the official website first.
It is also a good idea to upgrade pip before installing anything. An old pip can cause dependency errors.
python -m pip install --upgrade pip
Method 1: Install pdfplumber with pip
The simplest way to install pdfplumber is through pip. This works on Windows, macOS, and Linux.
Run this single command in your terminal:
pip install pdfplumber
If you are on macOS or Linux and have both Python 2 and Python 3, use pip3 instead:
pip3 install pdfplumber
On Windows, if pip is not recognized, use this safer form:
python -m pip install pdfplumber
This command tells Python to run the pip module directly. It avoids path issues on Windows[reference:1].
After a few seconds, you should see a success message. The output will look similar to this:
Successfully installed pdfplumber-0.11.10 pdfminer.six-20250506 pillow-11.2.1 pypdfium2-4.30.1
The exact version numbers may be different. That is normal.
Method 2: Install Inside a Virtual Environment
A virtual environment keeps your project dependencies separate. This is a best practice for Python projects.
First, create a new environment:
python -m venv pdfenv
Next, activate it. The command depends on your operating system.
On macOS and Linux:
source pdfenv/bin/activate
On Windows:
pdfenv\Scripts\activate
Once activated, your terminal prompt will show the environment name. Now install pdfplumber:
pip install pdfplumber
This installation stays inside the pdfenv folder. It will not affect your system Python.
Method 3: Install with Conda
If you use Anaconda or Miniconda, you can install pdfplumber from conda-forge. This is a community-maintained channel.
conda install -c conda-forge pdfplumber
Conda handles binary dependencies well. It is a good choice on Windows if pip fails.
What Dependencies Does pdfplumber Install?
When you install pdfplumber, pip automatically installs three dependencies. You do not need to install them manually[reference:2].
- pdfminer.six: The core PDF parsing engine.
- Pillow: An image processing library.
- pypdfium2: A PDF rendering library.
These packages are required for pdfplumber to work. If one fails to install, pdfplumber will not run.
How to Verify the Installation
After installing, open a Python interpreter. You can do this by typing python in your terminal.
Then run this code:
import pdfplumber
print(pdfplumber.__version__)
If the installation worked, you will see the version number. For example:
0.11.10
If you see an error, the library is not installed correctly. Move to the troubleshooting section below.
Common Installation Errors and Fixes
Sometimes the install does not go smoothly. Here are the most common problems and their solutions.
Error: "No module named pdfplumber"
This means Python cannot find the library. It usually happens when you install into the wrong environment.
Check which Python and pip you are using. Run:
which python
which pip
On Windows, use where python and where pip. Make sure they point to the same environment.
Then reinstall using python -m pip install pdfplumber. This forces the install into the correct Python[reference:3].
Error: "pdfminer3k" Conflict
If you previously installed pdfminer3k, it can conflict with pdfminer.six. The solution is to uninstall the old package first[reference:4].
pip uninstall pdfminer3k
pip install pdfplumber
After this, pdfplumber should import without issues.
Error: Permission Denied
On macOS and Linux, you may see a permission error. This happens when you try to install into a system folder.
Do not use sudo pip install. That can break your system Python. Instead, use a virtual environment or add the --user flag:
pip install --user pdfplumber
Error: Network Timeout
If the download is slow or times out, your network may be blocking PyPI. You can use a mirror source[reference:5].
For example, in China you can use the Tsinghua mirror:
pip install pdfplumber -i https://pypi.tuna.tsinghua.edu.cn/simple
This speeds up the download significantly.
Error: Cryptography Version Issue
On some systems, the cryptography package causes import errors. A community fix is to install an older version[reference:6].
pip install cryptography==41.0.2
pip install pdfplumber
Try this only if the normal install fails at the import step.
Basic Usage After Installation
Once pdfplumber is installed, you can start extracting text. Here is a simple example.
Create a Python file named extract.py and add this code:
import pdfplumber
# Open the PDF file
with pdfplumber.open("example.pdf") as pdf:
# Get the first page
first_page = pdf.pages[0]
# Extract all text from the page
text = first_page.extract_text()
print(text)
Replace example.pdf with the path to your own PDF file. The open method returns a PDF object. The pages attribute gives you a list of pages. The extract_text method pulls the text.
If your PDF has tables, you can use the extract_table method:
import pdfplumber
with pdfplumber.open("report.pdf") as pdf:
page = pdf.pages[0]
table = page.extract_table()
for row in table:
print(row)
The output will be a list of lists. Each inner list represents one row of the table.
['Name', 'Age', 'City']
['Alice', '30', 'New York']
['Bob', '25', 'London']
This makes it easy to convert PDF tables into CSV or Excel files.
Tips for a Clean Installation
Follow these tips to avoid problems.
First, always use a virtual environment. It isolates your project and prevents version conflicts.
Second, keep pip updated. Run python -m pip install --upgrade pip regularly.
Third, install pdfplumber last in your dependency list. This lets pip resolve shared dependencies correctly.
Fourth, if you use Jupyter Notebook, install pdfplumber in the same kernel. Use !pip install pdfplumber inside a notebook cell.
Conclusion
Installing pdfplumber in Python is a quick process. The standard command is pip install pdfplumber. For a clean setup, use a virtual environment and upgrade pip first.
pdfplumber automatically brings in its core dependencies: pdfminer.six, Pillow, and pypdfium2. You do not need to install them separately.
If you hit an error, check your Python environment, uninstall conflicting packages like pdfminer3k, or try a mirror source. Most issues are easy to fix.
Once installed, you can extract text and tables from PDFs with just a few lines of code. Start with a simple PDF and explore the library's features step by step.