Building with Python 3, Qt 5 on Ubuntu 18.04
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Building with Python 3, Qt 5 on Ubuntu 18.04
I sat down this evening with the intent to build a shiny new FreeCAD, with Qt5 and Python 3, though I'd be happy with just Qt5 for now if Python 3 isn't ready for prime time. My thinking was that PySide2 is probably better exercised with Python 3, but maybe that's not true.
Anyway, I'm not finding the packaging + cmake recipe to be intuitive - does anyone have it figured out already?
Anyway, I'm not finding the packaging + cmake recipe to be intuitive - does anyone have it figured out already?
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
As I am using virtual environments, I didn't have to add many things to the cmake... So as long as we are in this transition-phase (py2->py3, qt4->qt5), you have to set at least some additional variables... Adding them all in the cMakeLists.txt is (in my mind) not the best practice.
here is the recipe I use for py3/qt5 builds (linux and osx):
https://github.com/conda-forge/freecad- ... e/build.sh
but I guess most of the things are conda-specific and not python3-specific.
ps.: at least you have 2 variables for pyside2 and shiboken to point to the python3 configs:
PYTHON_CONFIG_SUFFIX (search for this file: ShibokenConfigPYTHON_CONFIG_SUFFIX.cmake)
PYTHON_BASENAME (search for this file: PySideConfigPYTHON_BASENAME.cmake
Then setting the path to the python-interpreter is maybe also necessary.
here is the recipe I use for py3/qt5 builds (linux and osx):
https://github.com/conda-forge/freecad- ... e/build.sh
but I guess most of the things are conda-specific and not python3-specific.
ps.: at least you have 2 variables for pyside2 and shiboken to point to the python3 configs:
PYTHON_CONFIG_SUFFIX (search for this file: ShibokenConfigPYTHON_CONFIG_SUFFIX.cmake)
PYTHON_BASENAME (search for this file: PySideConfigPYTHON_BASENAME.cmake
Then setting the path to the python-interpreter is maybe also necessary.
- kkremitzki
- Veteran
- Posts: 2515
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
The daily PPA currently has PySide 2 packages uploaded for 18.04 only; I tried uploading my Pivy package as well, which depends on PySide 2, but for some reason it wasn't able to find the packages and failed to build.
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
Thanks looo - that Conda sure looks much simpler than using the normal apt, pip, etc by themselves...
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
Likely Conda isn't easier per se. Both Conda and Ubuntu/Debian/PPA efforts require packaging effort. Try to add or upgrade PySide2/Qt5 packages on Conda for example and notice how the challenges involved are similar. Building FreeCAD against Py3 and Qt5 on Ubuntu isn't all that much different or harder to achieve compared to building against Py2 and Qt4. The main problem is/was the lack of PySide2 package and too old Qt5 version to be useful. If @kkremitzki added PySide2 package to the PPA and Ubuntu 18.04 providing Qt 5.9. That should satisfy the FreeCAD build dependencies quite well now.
P.S. In addition ATM we provide both Py2/Qt4 (PPA based) and Py3/Qt5 (Conda based) AppImages on FreeCAD GitHub releases page. To test and use them easily and see how things behave. Without the need to compile anything.
P.S. In addition ATM we provide both Py2/Qt4 (PPA based) and Py3/Qt5 (Conda based) AppImages on FreeCAD GitHub releases page. To test and use them easily and see how things behave. Without the need to compile anything.
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
One thing that is simpler, is dealing with different versions of the same package. There is always only one qt and only one python version in one environment (conda)Likely Conda isn't easier per se. Both Conda and Ubuntu/Debian/PPA efforts require packaging effort.
Dealing with different versions of the same package has high potential to mess up a system. I know ubuntu and Debian try to solve this, but still it's only a workaround. In the end you want a system to be as consistent as possible, and therefor different versions of the same packe should be avoided. This is true for any dependency (boost, python, qt,...)
Hopefully there are some py3-only distros available soon...
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
Just a general update on this:
* Qt 5 requires PySide2, which is only just beginning to be distributed. This seems to be the main issue at this stage.
* Building with Qt 4 and Python 3 is tricky, because some of the PySide (not PySide2) tools/libraries want to pull in Python 2 libraries. The packaging dependencies are such that you can't install everything we need from PySide only for Python 3...
* Ubuntu 18.04 is distributed with Qt5.9.5, but most of the PySide2 packaging at this stage is for Qt5.11
kkremitzki - I've got "deb http://ppa.launchpad.net/freecad-mainta ... ily/ubuntu bionic main" added to my apt sources, which seems to be bringing in the Debian PySide2 (https://tracker.debian.org/pkg/pyside2) - is that correct? On my Ubuntu 18.04 machine, trying to install libpyside2-py3-5.11 leads to an unmet dependency on "Upstream-Version". I'm also wondering how this package will expect Qt5.11 to be installed - mine's in /opt/qt511 - should I be installing Qt5.11 from Qt directly?.
* Qt 5 requires PySide2, which is only just beginning to be distributed. This seems to be the main issue at this stage.
* Building with Qt 4 and Python 3 is tricky, because some of the PySide (not PySide2) tools/libraries want to pull in Python 2 libraries. The packaging dependencies are such that you can't install everything we need from PySide only for Python 3...
* Ubuntu 18.04 is distributed with Qt5.9.5, but most of the PySide2 packaging at this stage is for Qt5.11
kkremitzki - I've got "deb http://ppa.launchpad.net/freecad-mainta ... ily/ubuntu bionic main" added to my apt sources, which seems to be bringing in the Debian PySide2 (https://tracker.debian.org/pkg/pyside2) - is that correct? On my Ubuntu 18.04 machine, trying to install libpyside2-py3-5.11 leads to an unmet dependency on "Upstream-Version". I'm also wondering how this package will expect Qt5.11 to be installed - mine's in /opt/qt511 - should I be installing Qt5.11 from Qt directly?.
- kkremitzki
- Veteran
- Posts: 2515
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
Ahh, that might explain why Pivy didn't build. I'll take a look. it should have just been built against the system Qt.ian.rees wrote: ↑Sat Aug 11, 2018 11:36 pm kkremitzki - I've got "deb http://ppa.launchpad.net/freecad-mainta ... ily/ubuntu bionic main" added to my apt sources, which seems to be bringing in the Debian PySide2 (https://tracker.debian.org/pkg/pyside2) - is that correct? On my Ubuntu 18.04 machine, trying to install libpyside2-py3-5.11 leads to an unmet dependency on "Upstream-Version". I'm also wondering how this package will expect Qt5.11 to be installed - mine's in /opt/qt511 - should I be installing Qt5.11 from Qt directly?.
Re: Building with Python 3, Qt 5 on Ubuntu 18.04
Hmm, I'm not sure if that's going to work, at least with the PySide2 deb that's currently available. Ubuntu 18.04 ships with Qt 5.9, but I think the PySide2 deb is built with Qt5.11.