- How to install PyQt5 in Python 3 (Ubuntu 14.04)
- 4 Answers 4
- Installation
- Configuring to run from terminal
- Code Generation
- Desktop Entry
- How to install PyQt5 in Python3
- Install PyQt5 on Ubuntu Linux Install PyQt5 on Ubuntu and other Debian-based Linux distributions
- Install PyQt5 with pip
- Purchasing Power Parity
- Install PyQt5 via apt
- How To Install python3-pyqt5 on Ubuntu 22.04
- What is python3-pyqt5
- Install python3-pyqt5 Using apt-get
- Install python3-pyqt5 Using apt
- Install python3-pyqt5 Using aptitude
How to install PyQt5 in Python 3 (Ubuntu 14.04)
Online I find the following steps: http://pyqt.sourceforge.net/Docs/PyQt5/installation.html But they are too many. What’s the easiest way to Install PyQt5 along with Python3 in Ubuntu 14.04 ?
The install process went ok. But got runtime error QtCore.so: undefined symbol: PySlice_AdjustIndices
4 Answers 4
Why not simply install it via apt-get?
sudo apt-get install python3-pyqt5
Otherwise you’d have to compile PyQt (and potentially Qt) by hand, which is cumbersome.
Well I documented the steps for Installing pyqt5 with qt designer and code generation here: https://gist.github.com/1dcd57542bdaf3c9d1b0dd526ccd44ff
Installation
pip3 install --user pyqt5 sudo apt-get install python3-pyqt5 sudo apt-get install pyqt5-dev-tools sudo apt-get install qttools5-dev-tools
Configuring to run from terminal
$ qtchooser -run-tool=designer -qt=5
Write the following in /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
/usr/lib/x86_64-linux-gnu/qt5/bin /usr/lib/x86_64-linux-gnu
Code Generation
#!/usr/bin/python3 import subprocess import sys child = subprocess.Popen(['pyuic5' ,'-x',sys.argv[1]],stdout=subprocess.PIPE) print(str(child.communicate()[0],encoding='utf-8'))
Create a symlink:
$ sudo ln uic.py "/usr/lib/x86_64-linux-gnu/qt5/bin/uic"
Desktop Entry
[Desktop Entry] Name=Qt5 Designer Icon=designer Exec=/usr/lib/x86_64-linux-gnu/qt5/bin/designer Type=Application Categories=Application Terminal=false StartupNotify=true Actions=NewWindow Name[en_US]=Qt5 Designer [Desktop Action NewWindow] Name=Open a New Window Exec=/usr/lib/x86_64-linux-gnu/qt5/bin/designer
save in ~/.local/share/application with .desktop extension
pip3 install —user pyqt5 will most likely throw Could not find a version that satisfies the requirement sip>=4.19.1 . I’m installing it from a fresh Linux installation.
How to install PyQt5 in Python3
Just installing it did not work for me. I had to uninstall it first, then reinstall it:
# upgrade pip python3 -m pip install --upgrade pip # uninstall python3 -m pip uninstall PyQt5 python3 -m pip uninstall PyQt5-sip python3 -m pip uninstall PyQtWebEngine # reinstall python3 -m pip install PyQt5 python3 -m pip install PyQt5-sip python3 -m pip install PyQtWebEngine
See here for my full answer, including how to install it for a specific version of Python3, such as Python3.8: How to install PyQt5 in Python3
Install PyQt5 on Ubuntu Linux
Install PyQt5 on Ubuntu and other Debian-based Linux distributions
Before you start the PyQt5 tutorial you will need to have a working installation of PyQt5 on your system. If you don’t have either set up yet, the following steps will guide you through how to do this on Linux.
This guide is also available for macOS and Windows.
Note that the following instructions are only for installation of the GPL licensed version of PyQt. If you need to use PyQt in a non-GPL project you will need to purchase an alternative license from Riverbank Computing to release your software.
Install PyQt5 with pip
The simplest way to install PyQt5 on Linux is to use Python’s pip packaging tool, just as for other packages. For Python3 installations this is usually called pip3 .
Downloadable ebook (PDF, ePub) & Complete Source code
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]
Purchasing Power Parity
Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Install PyQt5 via apt
Packages for PyQt5 are available in the repositories of most distributions, although they may sometimes be out of date. Check first to ensure you’re getting an up to date version, and if not use the pip method above. In Ubuntu you can install either from the command line or via «Software Center». The package you are looking for is named python3-pyqt5 .
You can also install these from the command line as follows —
sudo apt install python3-pyqt5
After install is finished, you should be able to run python (or python3 ) and import PyQt5 without errors.
Python 3.7.6 Type "help", "copyright", "credits" or "license" for more information. >>> import PyQt5 >>>
How To Install python3-pyqt5 on Ubuntu 22.04
In this tutorial we learn how to install python3-pyqt5 on Ubuntu 22.04.
What is python3-pyqt5
PyQt5 exposes the Qt5 API to Python 3. This package contains the following modules:
- QtCore
- QtDBus
- QtDesigner
- QtGui
- QtHelp
- QtNetwork
- QtPrintSupport
- QtTest
- QtWidgets
- QtXml
There are three ways to install python3-pyqt5 on Ubuntu 22.04. We can use apt-get , apt and aptitude . In the following sections we will describe each method. You can choose one of them.
Install python3-pyqt5 Using apt-get
Update apt database with apt-get using the following command.
After updating apt database, We can install python3-pyqt5 using apt-get by running the following command:
sudo apt-get -y install python3-pyqt5
Install python3-pyqt5 Using apt
Update apt database with apt using the following command.
After updating apt database, We can install python3-pyqt5 using apt by running the following command:
sudo apt -y install python3-pyqt5
Install python3-pyqt5 Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.