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
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

triplus wrote: Tue Jun 12, 2018 9:37 pm OK then i will try to create an AppImage from it (likely tomorrow) and see how that goes
Great! If you have problems please just post on the forum. It's a weird build. I'm using looo's pivy package that I have copied to my PPA, but I have enabled trusty backports to get swig3, and I have the official FreeCAD-daily as a dependency to get occt. I get many self-test errors when installing the FreeCAD-testing package on my machine, compared to a natively compiled version, that should be using the same dependencies.
"fight the good fight"
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

Hi @sgrogan

I won't have time to further look into this before Sunday. As for the progress. I was able to produce AppImage and run it. It complains on things like not using print() ... The two issues i noticed that need fixing are desktop-file-validate freecad-testing.desktop doesn't pass ATM and under Exec line in desktop file it should only say freecad-testing. The second one is Sketcher workbench edit mode isn't working ATM (didn't run tests yet). The first issue should be easy to resolve. As for the second one i am guessing that the procedure used in PPA recipe to build FreeCAD would likely need some tweaking.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

Did some more testing today. Both AppImage and the package from PPA suffer some issues (like the mentioned Sketcher edit mode issue). I read this thread for clues and i guess:

https://forum.freecadweb.org/viewtopic. ... 99#p207813

The easiest thing to try out next would be to create an Ubuntu 16.04 PPA build with the same recipe. And to see if the issue persist. If Python 3.4 ends up being too old i guess we can base the AppImage on Ubuntu 16.04. In addition in the following days i can try out building FreeCAD (Py3) on Ubuntu 14.04 and see how that goes.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

triplus wrote: Mon Jun 18, 2018 11:16 am Did some more testing today. Both AppImage and the package from PPA suffer some issues (like the mentioned Sketcher edit mode issue). I read this thread for clues and i guess:
Thanks for testing. I should have some time in a few hours to test my local 14.04 PY3 build. In the past I have had more problems when installing the PY3 PPA than I had with my local build.
"fight the good fight"
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

Take your time. For the next 2 days likely i will have minimum amount of free time.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

triplus wrote: Tue Jun 19, 2018 8:47 am Take your time. For the next 2 days likely i will have minimum amount of free time.
I will also need some more time. If you need something post here and I will try.
I will try to post a link to a 16.04 package in the next week.
"fight the good fight"
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

I had some free time over the weekend and first tried to create a FreeCAD Py3 build on Ubuntu 14.04. Satisfying dependencies took the most time and CMake still returns some errors but all in all it builds. I have just tested the produced build and i can enter the sketcher edit mode successfully. Therefore i am guessing the PPA builds should work too. And likely some tweaking of the recipe would be needed. Can you post a link to the PPA recipe you are using?

P.S. I didn't have to create any Boost related links and didn't tried to provide Pivy Py3 package for now.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

triplus wrote: Wed Jun 27, 2018 11:05 am Can you post a link to the PPA recipe you are using?
I'm using this debian folder https://git.launchpad.net/~freecad-main ... ?h=testing
I'm using looo's pivy package, hosted on my PPA, and swig3 from trusty-backports.
triplus wrote: Wed Jun 27, 2018 11:05 am P.S. I didn't have to create any Boost related links

Code: Select all

import libarea
Will reveal the problem if it exists. It relates specifically to boost-python. On my native build FreeCAD compiled fine without the links but would fail when trying to import the libarea module. Not sure if you have to switch to the Path WB.

I hope to have some time soon, sorry for the intermittent effort, but time is short for me at the moment.

I will try to build a 16.04 FreeCAD-testing on my PPA tomorrow.
"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 »

sgrogan wrote:On my native build FreeCAD compiled fine without the links but would fail when trying to import the libarea module.
Can you post the error?

It would be nice if we can switch to pybind11. as pybind11 is header-only it should be possible to simple copy some existing packages for other ubuntu-releases: https://launchpad.net/~fenics-packages/ ... es_filter= Isn't there a simple way to copy some packages from another ppa to the freecad-ppa?
I will try to build a 16.04 FreeCAD-testing on my PPA tomorrow.
I guess avoiding python < 3.5 is a good idea.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Porting to python3

Post by sgrogan »

looo wrote: Fri Jun 29, 2018 6:06 am Can you post the error?
I don't remember if libarea.so didn't build at all or if there was a python mis-match, due to libboost-python. CMake found the PY2 version of libboost-python unless the PY3 path was set w/ CMake. Setting the path fixed the problem. The python paths are different for Trusty(14.04) vs newer versions, so this may only apply to 14.04
"fight the good fight"
Post Reply