Porting to python3

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

sgrogan wrote:What are the steps to reproduce this?
It came up during usage of the glider workbench (exploring some objects with the freecad-python-console). I haven't found a way to reproduce the problem with a python script and I don't know which part introduce the problem. I hoped @wmayer has an idea what could be the reason...

sgrogan wrote:I am stuck :oops: I can't find the difference :(
Which distro did you use for your local build?
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

looo wrote: Tue Jul 10, 2018 8:11 am Which distro did you use for your local build?
I am using Kubuntu 14.04
I have Trusty backports enabled (This is to get swig3)
I have the FreeCAD daily PPA (This is where I get eigen and occt)
I have my personal PPA (This where I get pivy, I'm using the one you provided)

I believe I have the same on my personal PPA.
triplus wrote: Sat Jul 07, 2018 7:07 pm Didn't have much free time in the past days. Will look into it more in depth in the following days and report back.
No worries, my time is limited also.
"fight the good fight"
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

I did some testing in the past two days but no real results yet. I went through the debian folder and replicated the build with the same flags on my Ubuntu 14.04 system. I can import area and enter the sketcher edit mode just fine. Therefore the flags aren't the problem. Dependencies likely aren't contributing to the issue. Everything else doesn't feel like it could contribute to the issue. When you will have time give it another try by first changing:

AppImage related fix in freecad-testing.desktop:

Code: Select all

Exec=/usr/bin/freecad-testing --single-instance %U
To:

Code: Select all

Exec=freecad-testing --single-instance %U
In rules:

Code: Select all

override_dh_auto_configure:
	dh_auto_configure -- $(extra_flags) -DCMAKE_CXX_COMPILER=/usr/bin/mpic++
To:

Code: Select all

override_dh_auto_configure:
	dh_auto_configure -- $(extra_flags)
As the flag is already set in extra_flags.

Code: Select all

-DBoost_PYTHON_LIBRARY_RELEASE="/usr/lib/x86_64-linux-gnu/libboost_python-py34.so"

Code: Select all

-DBoost_PYTHON_LIBRARY_RELEASE="/usr/lib/x86_64-linux-gnu/libboost_python-py34.so.1.55.0"
This is how i did it in my test but likely it shouldn't make a difference.

After i will look further for clues and likely will go after AppImage. To see if it will pan out or some issues (beyond the mentioned one) are expected in that area too. After all that if no obvious clues for fixing the entering Sketcher edit mode issue will emerge. We can still try out the Ubuntu 16.04 option.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

Thanks triplus
triplus wrote: Wed Jul 11, 2018 8:59 pmIn rules:

Code: Select all

override_dh_auto_configure:
	dh_auto_configure -- $(extra_flags) -DCMAKE_CXX_COMPILER=/usr/bin/mpic++
This was required for a newer Ubuntu release and didn't hurt 14.04 for the freecad-daily package, in the past. I don't have this on my local build though, so maybe this is a clue.
"fight the good fight"
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

OT again: After a chat with a appimage-developer I was able to create a working appimage with conda-dependencies. I haven't tried on anything other than ubuntu, so it's possible there are still problems.

I had to do some hacks to get it working:
- assume fontconfig is in /ets/fonts
- setting QT_QPA_PLATFORM_PLUGIN_PATH and other variables

but all in all the build script is quite clean: https://github.com/looooo/freecad_conda ... ppimage.sh
to create the appimage conda has to be available.

The size is still bigger compared to the appimage based on ubuntu-packages. I guess there is still potential to optimize the size...
If you try it, please give a feedback if it worked: https://github.com/looooo/freecad_conda ... ag/0.18-b0
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

I gave it a quick try. Things like no global menu support on Ubuntu 16.04 are i guess less of the problem for now. Import area works OK. Importing Matplotlib, SciPy ... would i guess need additional packaging effort on Conda. Or are the libaries already available but just not added to AppImage? Trying to start Addon manager or Sketcher edit mode ... results in FreeCAD crash. It's interesting i guess for your AppImage to crash when trying to enter Sketcher edit mode too. ;)
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

thanks for testing.
triplus wrote:Importing Matplotlib, SciPy ... would i guess need additional packaging effort on Conda. Or are the libaries already available but just not added to AppImage?
conda + pip allows to install nearly anything. I simple wanted to keep the appimage as small as possible.
triplus wrote: Trying to start Addon manager or Sketcher edit mode ... results in FreeCAD crash.
The Addonmanager works for me, but raise a exception. I guess there is missing also a library. I will have a look.
triplus wrote:It's interesting i guess for your AppImage to crash when trying to enter Sketcher edit mode too.
Yes this is interesting. Maybe there is something wrong with your system/config? I can't reproduce this on 16.04.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

looo wrote: Thu Jul 12, 2018 11:17 am Yes this is interesting. Maybe there is something wrong with your system/config? I can't reproduce this on 16.04.
If nobody else will try i can try again tomorrow as likely i won't have much more free time today. On fresh Ubuntu 16.04. For now i only had a quick option to try on Ubuntu 14.04. Trying to enter Sketcher workbench i get libTKMath.so.7: undefined symbol ... But this i guess could be related to the fact glibc being too new or something like that. And it isn't supposed to work on Ubuntu 14.04 anyway.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

triplus wrote: libTKMath.so.7: undefined symbol
Maybe the system libTKMath is used instead of the bundled. Isn't libTKMath a occt library?Maybe I have to reanable this line:
https://github.com/looooo/freecad_conda ... /AppRun#L4

Are you using occt7.1 on this system?
triplus wrote:But this i guess could be related to the fact glibc being too new or something like that. And it isn't supposed to work on Ubuntu 14.04 anyway.
Theoretically it should work, as all packages are build with centos6 which was released in 2014. Previous tests with conda-environments on ubuntu 14.04 also worked...
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

btw.: Maybe the problem with sketcher comes from any add-on. Many of the addons are not py3-compatible... And python code can still produce crashes for FreeCAD with python3 (recently I posted one where the call-hints lead to a crash...)

edit: example: I installed command-panel and FreeCAD crashes when switching to sketcher-workbench
Post Reply