Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.
Qt for Python/GettingStarted/X11: Difference between revisions
mNo edit summary |
No edit summary |
||
(25 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Qt for Python]] | |||
== Official documentation == | |||
Refer to the [https://doc.qt.io/qtforpython/gettingstarted-linux.html official docs] to get started on Linux/X11. | |||
== Development == | == Development == | ||
Development happens in the 5. | Development happens in the 5.15 and dev branches of the [http://code.qt.io/cgit/pyside/pyside-setup.git/ pyside-setup repository]. | ||
The top level repository has the following submodules: | The top level repository has the following submodules: | ||
* sources/pyside2-tools: | * sources/pyside2-tools: pyside2-lupdate | ||
Contributions follow the [[Qt_Project_Guidelines|standard process]]. | Contributions follow the [[Qt_Project_Guidelines|standard process]]. | ||
Line 69: | Line 17: | ||
(e.g.: Ubuntu, the packages python3-dbg, libpython3-dbg provide a debug binary python3-dbg) | (e.g.: Ubuntu, the packages python3-dbg, libpython3-dbg provide a debug binary python3-dbg) | ||
If your distribution does not include them, you can [https://www.python.org/downloads/ download python] | If your distribution does not include them, you can [https://www.python.org/downloads/ download python] sources | ||
and compile it by yourself, e.g. | and compile it by yourself, e.g. | ||
./configure --prefix=/ | ./configure --prefix=/where/to/install/python/path CFLAGS="-O0 -fno-inline -fno-omit-frame-pointer -g" LDFLAGS="-O0" CPPFLAGS="-O0" OPT="-O0 -g" | ||
make | make | ||
make install | make install | ||
It is also recommended to use a [http://docs.python-guide.org/en/latest/dev/virtualenvs/ Virtual Environment] for testing to be able to always start from a clean base and avoid issues with write permissions in installations. | It is also recommended to use a [http://docs.python-guide.org/en/latest/dev/virtualenvs/ Virtual Environment] for testing to be able to always start from a clean base and avoid issues with write permissions in installations. | ||
Line 84: | Line 32: | ||
==== Troubleshooting ==== | ==== Troubleshooting ==== | ||
* '''Wrong RUNPATH''' | * '''Wrong RUNPATH / rpath''' | ||
If | If you choose to build Python from sources in shared library configuration, it might be the case that the rpath is not set properly, which means that the built python binary might use the system python shared library, instead of the custom build shared library. | ||
instead of | You can ''patch'' the interpreter rpath values with a binary that PySide2 provides: | ||
cd pyside-setup | cd pyside-setup | ||
./patchelf --set-rpath /path/to/your/local/python/lib /path/to/your/python/virtualenv/binary/python | ./patchelf --set-rpath /path/to/your/local/python/lib /path/to/your/python/virtualenv/binary/python | ||
And then proceed to re-install PySide2. | And then you can proceed to re-install PySide2. | ||
(you can check if the patch worked with ''readelf -d /path/to/your/python/virtualenv/binary/python'') | (you can check if the patch worked with ''readelf -d /path/to/your/python/virtualenv/binary/python'') | ||
* '''Missing libICU | * '''Missing libICU causes linking problems''' | ||
From 5.9+ you can get a copy of libICU specifying ''--standalone'' (but not including ''--iculib-url'') as an argument to ''setup.py'' execution. | From 5.9+ you can get a copy of libICU by specifying ''--standalone'' (but not including ''--iculib-url'') as an argument to ''setup.py'' execution. | ||
* '''Recompile with -fPIC''' | |||
This issue is usually encountered when using pyenv in a Linux distribution. It's necessary to reinstall python using pyenv with the following addendum: <syntaxhighlight> | |||
env PYTHON_CFLAGS=-fPIC pyenv install -v 2.7.8 | |||
</syntaxhighlight> |
Latest revision as of 10:56, 2 January 2020
Official documentation
Refer to the official docs to get started on Linux/X11.
Development
Development happens in the 5.15 and dev branches of the pyside-setup repository.
The top level repository has the following submodules:
- sources/pyside2-tools: pyside2-lupdate
Contributions follow the standard process.
It is helpful to have debug binaries or symbols for Python available. Debug packages can be installed separately in some Linux distributions (e.g.: Ubuntu, the packages python3-dbg, libpython3-dbg provide a debug binary python3-dbg)
If your distribution does not include them, you can download python sources and compile it by yourself, e.g.
./configure --prefix=/where/to/install/python/path CFLAGS="-O0 -fno-inline -fno-omit-frame-pointer -g" LDFLAGS="-O0" CPPFLAGS="-O0" OPT="-O0 -g" make make install
It is also recommended to use a Virtual Environment for testing to be able to always start from a clean base and avoid issues with write permissions in installations.
A new virtual environment can be created as follows:
virtualenv -p /usr/bin/python3-dbg testenv
Please take into consideration that the binary name might be different in your system, and that you can choose a different name for the environment instead of testenv.
Troubleshooting
- Wrong RUNPATH / rpath
If you choose to build Python from sources in shared library configuration, it might be the case that the rpath is not set properly, which means that the built python binary might use the system python shared library, instead of the custom build shared library. You can patch the interpreter rpath values with a binary that PySide2 provides:
cd pyside-setup ./patchelf --set-rpath /path/to/your/local/python/lib /path/to/your/python/virtualenv/binary/python
And then you can proceed to re-install PySide2. (you can check if the patch worked with readelf -d /path/to/your/python/virtualenv/binary/python)
- Missing libICU causes linking problems
From 5.9+ you can get a copy of libICU by specifying --standalone (but not including --iculib-url) as an argument to setup.py execution.
- Recompile with -fPIC
This issue is usually encountered when using pyenv in a Linux distribution. It's necessary to reinstall python using pyenv with the following addendum:
env PYTHON_CFLAGS=-fPIC pyenv install -v 2.7.8