How to Install PyQt5 in Python
Python bindings for the Qt cross platform application toolkit
pip install PyQt5
What is PyQt5?
Python bindings for the Qt cross platform application toolkit
PyQt5 - Comprehensive Python Bindings for Qt v5
Qt is set of cross-platform C++ libraries that implement high-level APIs for accessing many aspects of modern desktop and mobile systems. These include location and positioning services, multimedia, NFC and Bluetooth connectivity, a Chromium based web browser, as well as traditional UI development.
PyQt5 is a comprehensive set of Python bindings for Qt v5. It is implemented as more than 35 extension modules and enables Python to be used as an alternative application development language to C++ on all supported platforms including iOS and Android.
Quick Start
Minimal example to get started with PyQt5:
import PyQt5
print(PyQt5.__version__)
Installation
pip (standard)
pip install PyQt5
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install PyQt5
pip3
pip3 install PyQt5
conda
conda install -c conda-forge PyQt5
Poetry
poetry add PyQt5
Dependencies
Installing PyQt5 will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import PyQt5; print(PyQt5.__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 PyQt5 with pip.
ModuleNotFoundError: No module named 'PyQt5'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install PyQt5. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'PyQt5' (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 PyQt5 to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'PyQt5'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show PyQt5 and upgrade with pip install --upgrade PyQt5.
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 PyQt5. 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 PyQt5
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 PyQt5
Recent Releases
| Version | Released |
|---|---|
5.15.11 latest |
2024-07-19 |
5.15.10 |
2023-10-14 |
5.15.9 |
2023-02-06 |
5.15.8 |
2023-01-28 |
5.15.7 |
2022-06-18 |
Manage PyQt5
Upgrade to latest version
pip install --upgrade PyQt5
Install a specific version
pip install PyQt5==5.15.11
Uninstall
pip uninstall PyQt5
Check what is installed
pip show PyQt5