What is the recommended way of setting up PySide for development in Ubuntu?
sudo apt-get install python3-pyside
?sudo pip install pysid
For all Python packages at this point I prefer to use pip, and not even the ubuntu-managed pip but a custom install. It is better not to mix the two, i.e. if you already have packages installed using the python3-pip Ubuntu package, continue using that.
To install custom pip for a single user, you can first set up the latest version of pip as described here:
https://pip.pypa.io/en/stable/installing/
That is, in short:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 ./get-pip.py
To install PySide with the custom pip use:
pip install --user PySide2
To install PySide with the pip from an Ubuntu-managed apt package (thanks @Suzanne Dupéron for the update on that):
sudo apt install python3-pip && pip3 install PySide2
Currently**, if you have Qt 5.x set as default on your Ubuntu, you may find that
sudo apt-get install python3-pyside
(or python-pyside if you still for some reason want the python 2.7 version) is the only way (without having to revert to Qt 4.x).
The other two ways would return errors of the sort: "Qt QTCORE library not found."
**check the original post date.PySide page on python.org read/reads "PySide requires Python 2.6 or later and Qt 4.6 or better. Qt 5.x is currently not supported."
[EDIT] Thanks to @JBentley for the update: PySide now supports Qt5.
sudo apt-get install python3-pyside
is probably the easiest way to install Pyside in Ubuntu.
All your options will work. It depends what you are trying to achieve with it and how portable it should be. What usually "just" works without problems is to create a virtualenv first:
apt-get -f install python-virtualenv
virtualenv ~/mypython2.7
With that you can simply use easy_install as recommended to install PySide in your local virtual environment:
~/mypython2.7/bin/easy_install PySide
If you want to build PySide, follow the extensive instructions on their github page
For development I would not install any development packages to system python - You should use virtualenv. Also if you want to save time, first create the distribution egg via "easy_install bdist_egg". Then you can install the egg to your virtualenv (or system python if you prefer) without recompiling everything. Complete instuctions on how to install dependencies, getting pyside source, building and installing are here