QtWidgets

Having trouble installing or compiling FreeCAD? Get help here.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

QtWidgets

Postby keithsloan52 » Tue Jan 01, 2019 9:24 pm

I am trying to use Geant4Py with FreeCAD.

Geant4Py uses Qt5 by default and whilst I can see how to build Geant4 with QT4 there is no obvious option for Geant4Py.
So I am after a version of FreeCAD that uses Qt5.

Reading the forum I see that freecad-daily has been update to use Qt5, but when I do a

Code: Select all

sudo apt-get update
sudo apt-get install freecad-daily
freecad-daily
And run I get a number of messages where modules cannot find QtWidgets

Code: Select all

During initialization the error No module named QtWidgets occurred in /usr/lib/freecad-daily/Mod/Ship/InitGui.py
Please look into the log file for further information
During initialization the error No module named QtWidgets occurred in /usr/lib/freecad-daily/Mod/Tux/InitGui.py
Please look into the log file for further information
During initialization the error No module named QtWidgets occurred in /usr/lib/freecad-daily/Mod/Plot/InitGui.py
Please look into the log file for further information
No module named QtWidgets
Is there some package I should install to get QtWidgets?
wmayer
Site Admin
Posts: 16665
Joined: Thu Feb 19, 2009 10:32 am

Re: QtWidgets

Postby wmayer » Wed Jan 02, 2019 10:06 am

You have to install PySide2 and shiboken2 which offer the Python bindings for Qt5.
User avatar
hardeeprai
Posts: 176
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: QtWidgets

Postby hardeeprai » Sun Apr 14, 2019 3:25 pm

wmayer wrote:
Wed Jan 02, 2019 10:06 am
You have to install PySide2 and shiboken2 which offer the Python bindings for Qt5.
To install FreeCAD.18 stable I did distribution upgrade from Ubuntu 16 LTS to 18LTS.

FreeCAD stable:

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.1.
Build type: Release
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

does not show start screen.

There are very few
Workbenches from View -> Workbench, 6 in total number,
which include "none" as well. On trying BIM, it says:

No module named 'DraftTools'
Traceback (most recent call last):
File "<string>", line 69, in Initialize

For freecad-daily:

For freecad-daily

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16093 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: 690774c0effe4fd7b8d2b5e2fb2b8c8d145e21ce
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

I got message:

No module named QtWidgets

On trying to opne BIM workbench, it throw message:

Traceback (most recent call last):
File "<string>", line 69, in Initialize
File "/usr/lib/freecad-daily/Mod/Draft/DraftTools.py", line 43, in <module>
from PySide import QtCore,QtGui
File "/usr/lib/freecad-daily/Ext/PySide/QtGui.py", line 2, in <module>
from PySide2.QtWidgets import *

pyside-tools 0.2.15 and shiboken 1.2.2-5 are installed. I could not file shiboken2 and puside2 from package manager.

What can I do?
--
H.S.Rai
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: QtWidgets

Postby NormandC » Sun Apr 14, 2019 3:51 pm

hardeeprai wrote:
Sun Apr 14, 2019 3:25 pm
To install FreeCAD.18 stable I did distribution upgrade from Ubuntu 16 LTS to 18LTS.
In my experience, distribution upgrades are always a risky business. They can mess up a system pretty bad. Myself I always make a fresh install.

I recommend you remove any freecad related package, delete both PPA repositories (sometimes the PPA will still link to the older Ubuntu version), then re-add the PPA and re-install freecad.

Note that the freecad-daily PPA is still stuck at 0.18.16093 for now, and is based on Python2/Qt5; the freecad-stable PPA offers the newer 0.18.1 version, and supports both Python2 and Python3 on Qt5. To enable Python 2, install freecad and freecad-python2; freecad-python3 is installed by default.
User avatar
hardeeprai
Posts: 176
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: QtWidgets

Postby hardeeprai » Mon Apr 15, 2019 2:12 pm

NormandC wrote:
Sun Apr 14, 2019 3:51 pm
In my experience, distribution upgrades are always a risky business. They can mess up a system pretty bad. Myself I always make a fresh install.
Yes, you are right. But I have been living with this since long, and able to learn many new things from such mess ;-)
NormandC wrote:
Sun Apr 14, 2019 3:51 pm
I recommend you remove any freecad related package, delete both PPA repositories (sometimes the PPA will still link to the older Ubuntu version), then re-add the PPA and re-install freecad.
I tried to do as above, but unable to get success till time. My focus was to run .18

Removed repositories of freecad.

Then added, and did update and installed freecad, got following error:

<q>

update-alternatives: using /usr/lib/freecad/bin/freecad-python3 to
provide /usr/bin/freecad (freecad) in auto mode
update-alternatives: warning: skip creation of /usr/lib/freecad/lib
because associated file /usr/lib/freecad-python3/lib (of link group
freecad) doesn't exist

</q>

Now on running freecad, got error:

freecad
freecad: error while loading shared libraries: libFreeCADGui.so:
cannot open shared object file: No such file or directory


and on running freecadcmd, getting error:

freecadcmd: error while loading shared libraries: libFreeCADApp.so:
cannot open shared object file: No such file or directory

Both these files are not there:

If I can get any hint, to solve it, will be great.

However, for the moment, I am using AppImage, got from:

https://github.com/FreeCAD/FreeCAD/releases
--
H.S.Rai
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: QtWidgets

Postby ezzieyguywuf » Mon Apr 15, 2019 8:40 pm

hardeeprai wrote:
Mon Apr 15, 2019 2:12 pm
Both these files are not there
What do you see when you issue the following command?

Code: Select all

dpkg-query -L freecad
What version of python do you have installed? What does the following command show?

Code: Select all

apt-cache policy freecad
User avatar
hardeeprai
Posts: 176
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: QtWidgets

Postby hardeeprai » Wed Apr 17, 2019 2:46 am

ezzieyguywuf wrote:
Mon Apr 15, 2019 8:40 pm

Code: Select all

dpkg-query -L freecad
hsrai@rai:~$ dpkg-query -L freecad
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/freecad
/usr/share/doc/freecad/changelog.Debian.gz
/usr/share/doc/freecad/changelog.gz
/usr/share/doc/freecad/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/freecad
/usr/share/mime
/usr/share/mime/packages
/usr/share/mime/packages/freecad.xml
hsrai@rai:~$
ezzieyguywuf wrote:
Mon Apr 15, 2019 8:40 pm

Code: Select all

apt-cache policy freecad
hsrai@rai:~$ apt-cache policy freecad
freecad:
Installed: 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1
Candidate: 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1
Version table:
*** 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1 500
500 http://ppa.launchpad.net/freecad-mainta ... ble/ubuntu bionic/main amd64 Packages
500 http://ppa.launchpad.net/freecad-mainta ... ble/ubuntu bionic/main i386 Packages
100 /var/lib/dpkg/status
0.16.6712+dfsg1-1ubuntu2 500
500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
hsrai@rai:~$
ezzieyguywuf wrote:
Mon Apr 15, 2019 8:40 pm
What version of python do you have installed?
Both 2 and 3.

hsrai@rai:~$ python
python python2.7-config python3.6 python3-unidiff
python2 python2-config python3.6m python-config
python2.7 python3 python3m
hsrai@rai:~$ python

Path of FreeCAD is:
hsrai@rai:~$ which freecad
/usr/bin/freecad
hsrai@rai:~$ ls -l /usr/bin/freecad
lrwxrwxrwx 1 root root 25 Apr 15 15:04 /usr/bin/freecad -> /etc/alternatives/freecad
hsrai@rai:~$ ls -l /etc/alternatives/freecad
lrwxrwxrwx 1 root root 36 Apr 15 15:04 /etc/alternatives/freecad -> /usr/lib/freecad/bin/freecad-python3
hsrai@rai:~$
--
H.S.Rai
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: QtWidgets

Postby ezzieyguywuf » Mon Apr 22, 2019 1:46 pm

hardeeprai wrote:
Wed Apr 17, 2019 2:46 am
hsrai@rai:~$ apt-cache policy freecad
freecad:
Installed: 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1
Candidate: 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1
I find this part interesting - it seems on the ppa that the latest daily posted is from march 15th, however you have something installed from april 6th.

Have you run `sudo apt-get update` recently? It could be your using an older package that for whatever does not work, and was thus reverted to an older commit (I'm just guessing here, but its worth a shot)
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: QtWidgets

Postby ezzieyguywuf » Mon Apr 22, 2019 2:13 pm

wmayer wrote:
Wed Jan 02, 2019 10:06 am
I am trying to use Geant4Py with FreeCAD.

Geant4Py uses Qt5 by default and whilst I can see how to build Geant4 with QT4 there is no obvious option for Geant4Py.
So I am after a version of FreeCAD that uses Qt5.
I think your thread may have gotten hijacked a bit, so sorry about that!

Looking through the Geant4 source code a bit, and specifically the Geat4Py portions, it seems that they use boost::python for wrapping the core c++ library in a python module. That being said, I don't see anything specific to Qt4 or Qt5 in the python wrapping code. In other words, if you compile the core library using qt4, I believe the python wrapper should also use the same, at it will simply call the Geant4 library as it was built.

That being said...
keithsloan52 wrote:
Tue Jan 01, 2019 9:24 pm
And run I get a number of messages where modules cannot find QtWidgets
As wmayer mentioned, you need pyside2 and shiboken2 installed - did this fix your problem?
User avatar
hardeeprai
Posts: 176
Joined: Sun May 23, 2010 2:41 pm
Location: Ludhiana, Punjab, India
Contact:

Re: QtWidgets

Postby hardeeprai » Tue Apr 23, 2019 11:36 am

ezzieyguywuf wrote:
Mon Apr 22, 2019 1:46 pm
I find this part interesting - it seems on the ppa that the latest daily posted is from march 15th, however you have something installed from april 6th.

Have you run `sudo apt-get update` recently? It could be your using an older package that for whatever does not work, and was thus reverted to an older commit (I'm just guessing here, but its worth a shot)
I am using Ubuntu 18.04.2 LTS (bionic) which has FreeCAD .16

https://packages.ubuntu.com/bionic/freecad

Even that also fail to install:

<q>

[Last few lines of apt-get install freeacad]

Selecting previously unselected package python-qt4-gl.
Preparing to unpack .../28-python-qt4-gl_4.12.1+dfsg-2_amd64.deb ...
Unpacking python-qt4-gl (4.12.1+dfsg-2) ...
Selecting previously unselected package python-pivy.
Preparing to unpack .../29-python-pivy_0.5.0~v609hg-4_amd64.deb ...
Unpacking python-pivy (0.5.0~v609hg-4) ...
Selecting previously unselected package freecad.
Preparing to unpack .../30-freecad_0.16.6712+dfsg1-1ubuntu2_amd64.deb ...
Unpacking freecad (0.16.6712+dfsg1-1ubuntu2) ...
dpkg: error processing archive /tmp/apt-dpkg-install-SjrGQV/30-freecad_0.16.6712+dfsg1-1ubuntu2_amd64.deb (--unpack):
trying to overwrite '/usr/share/freecad/Mod', which is also in package freecad-runtime 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1
Errors were encountered while processing:
/tmp/apt-dpkg-install-SjrGQV/30-freecad_0.16.6712+dfsg1-1ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

</q>

Then I did:

sudo add-apt-repository ppa:freecad-maintainers/freecad-stable
sudo apt-get update

It shows version 2:0.18.1+dfsg1~201904061907~ubuntu18.04.1 which in your opinion is from future date.

It got installed, but it fail to run. Same problem, as per my previous emails in this thread.

hsrai@rai:~$ freecad
freecad: error while loading shared libraries: libFreeCADGui.so: cannot open shared object file: No such file or directory
hsrai@rai:~$ freecadcmd
freecadcmd: error while loading shared libraries: libFreeCADApp.so: cannot open shared object file: No such file or directory
--
H.S.Rai