Install PySide6 on Ubuntu Linux

Install PySide6 on Ubuntu and other Debian-based Linux distributions
Heads up! You've already completed this tutorial.

Before you start creating applications with PySide6, you need to have a working installation of PySide6 on your system. In this step-by-step tutorial, you'll learn how to install PySide6 on Ubuntu Linux so you can start building Python GUI applications.

This guide is also available for macOS and Windows.

Preparing Ubuntu to Install PySide6

Before installing PySide6, we need to prepare our Ubuntu system and install a couple of essential tools. Python best practices recommend using virtual environments to isolate your Python projects and manage their dependencies effectively.

Unfortunately, the default Ubuntu installation doesn't include tools like the venv module, which allows us to create virtual environments, or the pip command, which lets us install external packages like PySide6. So, we need to install them from Ubuntu's repositories first.

Installing venv and pip on Ubuntu

To install the venv module and the pip package manager on Ubuntu, run the following commands in your terminal:

sh
$ sudo apt update
$ sudo apt install python3-venv python3-pip

The first command updates the package information from all configured software sources on your Ubuntu system. The second command downloads and installs the venv module and the pip command. Now, we are ready to create and activate a Python virtual environment for PySide6.

Creating a Python Virtual Environment

Once we've installed the venv module, we can proceed to create and activate a Python virtual environment for our PySide6 project:

sh
$ mkdir project/ && cd project/
$ python3 -m venv ./venv
$ source venv/bin/activate
(venv) $

First, we create a new working directory named project/ as a root for a hypothetical PySide6 project. Then, we create a new virtual environment with venv and activate it. Note how the prompt indicator changes to (venv) to signal that we're working inside an active virtual environment.

Install PySide6 on Ubuntu With pip

The quickest way to install PySide6 in a virtual environment on Ubuntu is to use pip. Run the following command in your active virtual environment:

1:1 Coaching & Tutoring for your Python GUIs project
Martin Fitzpatrick Python GUIs Coaching & Training
60 mins ($195) Book Now

1:1 Python GUIs Coaching & Training

Comprehensive code reviewBugfixes & improvements • Maintainability advice and architecture improvements • Design and usability assessment • Suggestions and tips to expand your knowledgePackaging and distribution help for Windows, Mac & Linux • Find out more.

sh
(venv) $ pip3 install pyside6

This command downloads PySide6 from the Python package index (PyPI) and installs it along with its dependencies into our virtual environment.

Verify the PySide6 Installation

After the PySide6 installation is finished, you should verify that everything is working correctly. Run the python3 command in your virtual environment to start an interactive session and import the library:

python
>>> import PySide6

If no errors appear, PySide6 has been installed successfully on your Ubuntu system and is ready to use.

You can also check which version of PySide6 was installed:

python
>>> import PySide6
>>> print(PySide6.__version__)

This will display the installed PySide6 version number, confirming everything is set up correctly.

Next Steps

Now that you've installed PySide6 on Ubuntu Linux, you're ready to start creating Python GUI applications with PySide6. You can also explore our PySide6 widgets library to discover the building blocks available for your applications.

Create GUI Applications with Python & Qt6 by Martin Fitzpatrick — (PySide6 Edition) The hands-on guide to making apps with Python — Save time and build better with this book. Over 15K copies sold.

Get the book

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak
Martin Fitzpatrick

Install PySide6 on Ubuntu Linux was written by Martin Fitzpatrick with contributions from Lalin Paranawithana and Leo Well.

Martin Fitzpatrick is the creator of Python GUIs, and has been developing Python/Qt applications for the past 12+ years. He has written a number of popular Python books and provides Python software development & consulting for teams and startups.