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 »

I do get 1 self-test error

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.4/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib/python3.4/unittest/case.py", line 577, in run
    testMethod()
  File "/home/sgrogan/freecad-py3-build/Mod/Test/Document.py", line 1261, in testDescent
    self.Doc = FreeCAD.open(tempFile)
OSError: Cannot get value from invalid enumeration
OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13999 (Git)
Build type: Unknown
Branch: master
Hash: ab1520b872821414c6ce4a15fb85d471ac2a2b03
Python version: 3.4.3
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.3.0.beta
Locale: English/UnitedStates (en_US)

self-test pass on Travis-CI though, which is default 14.04 libs
"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 »

This one I can reproduce with py3.6/linux/conda and py2.7/ubuntu-daily.
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 10:11 pm This one I can reproduce with py3.6/linux/conda and py2.7/ubuntu-daily.
This test must be run only from the /GUI? Otherwise Travis should fail?
"fight the good fight"
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

sgrogan wrote: Thu Jun 28, 2018 9:45 pm 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.
Take your time. Should this work?

Code: Select all

import libarea
If i try when using daily PPA builds it doesn't work (ImportError: No module named libarea).
looo wrote: Fri Jun 29, 2018 6:06 am I guess avoiding python < 3.5 is a good idea.
Before we proceed i guess we have to answer this. If Python < 3.5 is not an option we in my opinion shouldn't invest any effort to get Ubuntu 14.04 PPA Py3 builds up and running and should rather just try out the Ubuntu 16.04 option? To see how that goes and to use it as a basis for AppImage.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

triplus wrote:Before we proceed i guess we have to answer this. If Python < 3.5 is not an option we in my opinion shouldn't invest any effort to get Ubuntu 14.04 PPA Py3 builds up and running and should rather just try out the Ubuntu 16.04 option?
there was a statement in the cmake that python3.,4 doesn't have enough unicode-support. I don't know if this statement is still there, but I never tried python3.4 because of this. Also python3.4 will not live for ever.... Now we already have version 3.7 official released. But supporting 3.7 now is also not a good idea, because no packages are available for this version.
Again using a rolling-release to base the appimage on would make more sense as we have the choice which versions to use. But for appimage to work on as many distros as possible, this should be an old version (Does the ubuntu 16.04 appimage work on ubuntu 14.04?)

Maybe we should try to base an appimage on conda-packages. I think this should be possible. Maybe we can try to bring our efforts together. From the conda side all we have to do is:
- install miniconda
- conda install freecad

and then bundeling everything with appimage. Here I need your help. Is there a 1.2.3 description how to do this?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

it's even simpler. I can create a new environment in a AppDir with everything needed. This results in a directory-size with ~2.1gb. Creating the appimage results in a ~600mb file. I guess there are still many libraries which are not used. So with deleting them I guess we should be able to make the image a bit smaller.

But trying to run the appimage I get this error:

Code: Select all

execv error: Permission denied
setting permissions doesn't help. This is the AppDir I am using:
https://github.com/looooo/freecad_conda ... ter/AppDir
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

It will likely take us another week or two to succeed with the PPA based AppImage. Trying to do more would likely push the ETA much further in the future. Current Py3 build on Ubuntu 14.04 PPA has issues (that local build doesn't have). But it uses Python 3.4. Therefore if you say we shouldn't support Python 3.4 anymore. It doesn't feel right and worth the effort trying to fix Ubuntu 14.04 Py3 builds on the PPA. Therefore once @sgrogan will have time i feel best if he tries to create the Py3 build on his PPA for Ubuntu 16.04. And lets first see how that goes. If you by any chance have any interest to try that yourself. On your personal PPA. That would likely result in reaching the goal faster. You once invested effort in Py3 Pivy on PPA and as you can see it wasn't a wasted effort. After we have working Py3 build on the PPA i can try to turn it into an AppImage. If all this will pan out we should likely be good for a while.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

triplus wrote: You once invested effort in Py3 Pivy on PPA and as you can see it wasn't a wasted effort.
I tried 3 times, but finally accepted that there are easier tools for packaging. Until now it was wasted effort. And I am quite sure I won't spend time on this topic anymore.

Regarding the appimage with conda: There was only a simple error in the conda-appimage, but now everything seems to work. The appimage-size went further down to ~250mb (deleting static-libraries, executeables,...). Feel free to test this once it's uploaded:
https://github.com/looooo/freecad_conda ... e/releases


edit: There are some hard-coded paths which makes this not work on other plattforms...
edit2: hard-coded paths everywhere :D I guess appimages doesn't like them very much.
edit3: making conda-environments work on appimage is too difficult. I learned it the hard way.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

In reality it likely could be fixed and that is still a viable option for the future. But if we want to be more aggressive with Py3 builds i feel that making it work on PPA and trying to create AppImage out of it is our best shot ATM. In addition PPA will likely need to support Py3 builds in the future anyway. Therefore there is no wasted effort here.

All in all lets i guess focus on Ubuntu 16.04 Py3 PPA builds now. And see where does that take us. Hopefully ETA is around two weeks i guess. If it pans out completely that is still aggressive given the circumstances. ;)
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Porting to python3

Post by Jee-Bee »

triplus wrote: Mon Jul 02, 2018 4:11 pm I...if we want to be more aggressive with Py3 builds ...
Add just another build to travis. even if it don't compile for the next weeks (// (13/12) = months) than it is clear what happening.
The last python 3 build is 400 commits old :(
Post Reply