Skip to content

Instantly share code, notes, and snippets.

@amontalenti
Created August 29, 2015 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amontalenti/2e4b72b0931dbfaa93b0 to your computer and use it in GitHub Desktop.
Save amontalenti/2e4b72b0931dbfaa93b0 to your computer and use it in GitHub Desktop.
pyqt setup instructions

PyQt App

A PyQt application needs special build instructions.

PySide Setup

To install PySide, you'll need to follow the PySide installation guide, which will likely installing Qt at the system level along with development headers.

Note that to install PySide against Python 3.4 from source, it requires that your CPython interpreter was compiled with the --enable-shared configure option, which, by default, is not set.

The error you will get during compile-time if you have this scenario is:

relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not
... be used when making a shared object; recompile with -fPIC

To get a Python interpreter that could run PySide on a UNIX-based pyenv installation, you must use this special incantation:

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.4.3

You will then have an interpreter installed called "3.4.3" that can be used as the basis for virtualenvs and the like, by setting:

pyenv global 3.4.3

PyQt4 Setup

PyQt4 is an alternative to PySide as a Qt binding. It is a commercially supported, though GPL-licensed, product. It must be downloaded from the PyQt4 download page. Note that in order to build PyQt4, you may also need to install SIP from the SIP download page.

Build instructions for each of these is manual by running some combination of a Python configure script and GNU Make, e.g. make and make install. Some binaries are also available.

PyQt5 Setup

Although PyQt4 is used by the project, PyQt5 is a required dependency of the Qt deployment tool, pyqtdeploy. To get this working, you need to download PyQt5 from the official source. Note that in order to build PyQt5 alongside PyQt4, you'll need to specify the "qt5-qmake" executable path.

On my Linux system, this meant this magical incantation for the configure.py call before building PyQt5:

sudo apt-get install qt5declarative-base qt5-qmake
python configure.py --qmake /usr/lib/x86_64-linux-gnu/qt5/bin/qmake

Miniconda and Binaries

You can also consider using miniconda, which has binary packages for all of the above packages for all platforms.

Confirm Dependencies

Once the Python packages are installed, you should be able to check the Pandas and PySide versions in a Python shell:

$ python
>>> import PySide
>>> print(PySide.__version__)
1.0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment