Installation
Get python-pptx installed and ready to use in your Python environment.Requirements
Before installing python-pptx, ensure you have a compatible Python version:Python 3.8 or later is required. python-pptx is tested against Python 3.8, 3.9, 3.10, 3.11, and 3.12.
Install python-pptx
python-pptx is hosted on PyPI and can be installed using your preferred package manager.The package manager will automatically install all required dependencies for you.
Dependencies
python-pptx depends on the following packages, which are automatically installed:- lxml (>=3.1.0) - XML processing library
- Pillow (>=3.3.2) - Python Imaging Library for image handling
- XlsxWriter (>=0.5.7) - Required for charting features
- typing_extensions (>=4.9.0) - Backport of typing features
Installation steps
Check your Python version
Verify you have Python 3.8 or later installed:You should see output like
Python 3.8.0 or higher.Install python-pptx
Use pip to install python-pptx from PyPI:This will download and install python-pptx along with all required dependencies.
Virtual environments
It’s recommended to install python-pptx in a virtual environment to avoid conflicts with other projects.- venv
- conda
- poetry
Verify installation
Once installed, you can verify everything is working by creating a simple test:Troubleshooting
ImportError: No module named 'pptx'
ImportError: No module named 'pptx'
This means python-pptx is not installed in the current environment. Ensure you:
- Activated the correct virtual environment (if using one)
- Installed python-pptx using
pip install python-pptx - Are running Python from the same environment where you installed the package
lxml installation fails on macOS/Linux
lxml installation fails on macOS/Linux
The lxml library requires some system dependencies. Install them first:macOS:Ubuntu/Debian:RHEL/CentOS:
Pillow installation fails
Pillow installation fails
Pillow may require additional system libraries for image processing:macOS:Ubuntu/Debian:
Permission denied errors
Permission denied errors
If you get permission errors during installation, either:
- Use a virtual environment (recommended)
- Install for your user only:
pip install --user python-pptx - Use sudo (not recommended):
sudo pip install python-pptx
Upgrading python-pptx
To upgrade to the latest version of python-pptx:Next steps
Now that you have python-pptx installed, you’re ready to create your first presentation!Quickstart tutorial
Follow the quickstart guide to create your first PowerPoint presentation with python-pptx