PySide2 installation instructions for Linux can't work

Hi,

The book (appendix A, pages 641-642) states to run the following command to install PySide2 on Ubuntu Linux:

apt-get install python3-pyside2

Sadly that can’t work because there is no such package. PySide2 has been packaged for Debian/Ubuntu into a multitude of python3-pyside2.* packages instead, plus pyside2-tools and python-pyside2-doc. I wish there was a metapackage to install them all.

APT will return E: Package 'python3-pyside2' has no installation candidate.

Hey @nael thanks for letting me know. What would be the recommended way to install it on Ubuntu now do you think? Just using pip? I see that PyPi has a manylinux package for PySide2 so it should work.

Hi @martin, I’m not sure.

Installing PySide2 via pip in a virtual environment would definitely be the pythonic way. But as far as I know, neither pip nor venv are installed by default with the Python interpreter from the Debian/Ubuntu repositories. So on those distributions, with bash, the following should work:

sudo apt install python3-pip python3-venv

python3 -m venv /path/to/new/virtual/environment
source /path/to/new/virtual/environment/bin/activate

pip3 install pyside2

Alternatively, one could install PySide2 via pip outside of any virtual environment. I haven’t done such an installation in ages, but I think the following should still work and would result in a user-specific and a system-wide install, respectively:

sudo apt install python3-pip

pip3 --user install pyside2  # user-specific
sudo -H pip3 install pyside2 # system-wide

Finally installing PySide2 from the Debian/Ubuntu repositories should still be possible by installing all python3-pyside2.* packages, plus pyside2-tools (uic, rcc, lupdate on Ubuntu but apparently just lupdate on Debian?) and python-pyside2-doc:

sudo apt install $(apt-cache pkgnames python3-pyside2.) pyside2-tools python-pyside2-doc

But that may be overkill? Perhaps you can recommend a reasonable list of python3-pyside2.* packages, instead of us installing everything?

Also it might be worth getting in touch with the Debian maintainers of those packages. They might consider providing a metapackage, or several metapackages (-minimal, -full, this sort of thing).

PS1: There’s a snap package but it seems to be lagging behind. I’m not sure about it.

PS2: Here’s the full list of python3-pyside2.* packages:

$ apt-cache pkgnames python3-pyside2.
python3-pyside2.qtwidgets
python3-pyside2.qtxml
python3-pyside2.qtsensors
python3-pyside2.qtnetwork
python3-pyside2.qtdatavisualization
python3-pyside2.qtcharts
python3-pyside2.qtxmlpatterns
python3-pyside2.qtuitools
python3-pyside2.qtlocation
python3-pyside2.qtquickwidgets
python3-pyside2.qtpositioning
python3-pyside2.qtwebsockets
python3-pyside2.qttest
python3-pyside2.qtscript
python3-pyside2.qtprintsupport
python3-pyside2.qtcore
python3-pyside2.qtquick
python3-pyside2.qtwebengine
python3-pyside2.qtscripttools
python3-pyside2.qtwebenginewidgets
python3-pyside2.qtgui
python3-pyside2.qt3dcore
python3-pyside2.qtmultimedia
python3-pyside2.qtx11extras
python3-pyside2.qthelp
python3-pyside2.qtopengl
python3-pyside2.qtwebenginecore
python3-pyside2.qtopenglfunctions
python3-pyside2.qtmultimediawidgets
python3-pyside2.qtwebchannel
python3-pyside2.qtconcurrent
python3-pyside2.qtqml
python3-pyside2.qt3dlogic
python3-pyside2.qt3drender
python3-pyside2.qttexttospeech
python3-pyside2.qtsql
python3-pyside2.qtsvg
python3-pyside2.qtscxml
python3-pyside2.qt3dinput