How to Install PyQt6 on Different Platforms?

During a PyQt webinar, the installation of PyQt was the first topic of discussion, This is the first step that we need to get started with to build any applications. In this tutorial, I will explain how to install PyQt6 on different platforms.

What is PyQt6?

Before getting into installation, let’s clarify what PyQt6 is. PyQt6 is the latest version of PyQt, a set of Python bindings for The Qt Company’s Qt application framework. It enables you to create applications with a native look and feel on all supported platforms while using Python, one of America’s most popular programming languages.

PyQt6 offers several advantages over its predecessors:

  • Modern UI capabilities aligned with Qt6
  • Improved performance
  • Better high DPI support
  • Enhanced Python 3 integration
  • Improved type hinting

Read  Create QLineEdit Widget in PyQt6

Prerequisites for PyQt6 Installation

Before we begin, ensure you have:

  • Python 3.6.1 or newer (Python 3.9+ recommended)
  • Pip (Python package installer)
  • Basic knowledge of command-line operations
  • Administrator/sudo privileges (for system-wide installation)

To check your Python version, open your terminal or command prompt and type:

python --version

Now, let’s proceed with platform-specific installation instructions.

Check out Create QPushButton Widget in PyQt6

Install PyQt6 on Windows

Let us see different ways of installing PyQt6 on Windows.

Method 1: Use Pip (Recommended)

The simplest way to install PyQt6 on Windows is to use pip:

  1. Open Command Prompt as Administrator
  2. Execute the following command:
pip install PyQt6

Refer to the screenshot below to see the installation process.

Install PyQt6 on Different Platforms
  1. To verify the installation:
python -c "import PyQt6.QtCore; print(PyQt6.QtCore.QT_VERSION_STR)"

Method 2: Use Anaconda on Windows

If you’re using Anaconda (popular among data scientists in places like Boston and Chicago):

  1. Open Anaconda Prompt
  2. Run:
conda install -c anaconda pyqt
  1. Verify with:
python -c "import PyQt6.QtCore; print(PyQt6.QtCore.QT_VERSION_STR)"

Read Create QLabel Widget in PyQt6

Method 3: Build from Source on Windows

For advanced users who need custom configurations:

  1. Download Qt6 from the official website
  2. Download the SIP and PyQt6 source code
  3. Install Visual Studio Build Tools
  4. Follow the compilation instructions in the PyQt6 documentation

Install PyQt6 on macOS

Let us see different ways of installing PyQt6 on macOS.

Method 1: Use Pip on macOS

  1. Open Terminal
  2. Run:
pip3 install PyQt6
  1. Verify with:
python3 -c "import PyQt6.QtCore; print(PyQt6.QtCore.QT_VERSION_STR)"

Check out Basic Widgets in PyQt6

Method 2: Use Homebrew on macOS

Homebrew is a popular package manager for macOS, especially among developers in Silicon Valley:

  1. Install Homebrew if not already installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install PyQt6:
brew install pyqt@6
  1. Link Python to PyQt6:
brew link pyqt@6
  1. Verify installation:
python3 -c "import PyQt6.QtCore; print(PyQt6.QtCore.QT_VERSION_STR)"

Check out Create Icons for Windows in PyQt6

Install PyQt6 on Linux (Ubuntu/Debian)

Let us see different ways of installing PyQt6 on Linux.

Method 1: Use Pip on Ubuntu/Debian

  1. Update your package lists:
sudo apt update
  1. Install PyQt6 dependencies:
sudo apt install python3-pip python3-dev
  1. Install PyQt6:
pip3 install PyQt6
  1. Verify installation:
python3 -c "import PyQt6.QtCore; print(PyQt6.QtCore.QT_VERSION_STR)"

Method 2: Use System Packages on Ubuntu/Debian

  1. Install the system packages:
sudo apt update
sudo apt install python3-pyqt6
  1. Verify the installation:
python3 -c "import PyQt6.QtCore; print(PyQt6.QtCore.QT_VERSION_STR)"

Read Types of Windows in PyQt6

Install Additional PyQt6 Components

PyQt6 has several optional components you might want to install:

PyQt6 Tools for Designer and Other Qt Tools

pip install pyqt6-tools

QScintilla for Advanced Text Editing

pip install QScintilla

PyQt6-Charts for Data Visualization

pip install PyQt6-Charts

Troubleshoot Common PyQt6 Installation Issues

Let us learn how to troubleshoot some commonly faced issues during installation.

Missing Dependencies

If you encounter errors about missing dependencies:

pip install PyQt6-sip

Check out Create a Basic Window in PyQt6

Qt Designer Not Found

For Windows users:

  • Check the Scripts folder in your Python installation
  • Add it to your PATH environment variable

ImportError: DLL load failed

This common error on Windows can be resolved by:

  1. Installing Visual C++ Redistributable
  2. Reinstalling PyQt6 with:
pip uninstall PyQt6 PyQt6-Qt6 PyQt6-sip
pip install PyQt6

Conclusion

In this tutorial, I explained how to install PyQt6 on different platforms. I covered installing PyQt6 on Windows, macOS, on Linux and installing some additional PyQt components. I also discussed how to troubleshoot common issues faced during installation.

Related tutorials you may read:

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.