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!
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: Porting to python3

Post by mlampert »

looo wrote: Mon Jun 11, 2018 2:42 am simple install freecad with python 3 and use it.....
I guess currently the most problematic workbench is Path. Maybe trying to do a path-tutorial with a py3 build would be a good start.
Is there a quick intro on how to "build" FC from source for python3 ?
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

mlampert wrote: Mon Jun 11, 2018 5:39 am Is there a quick intro on how to "build" FC from source for python3 ?
On Ubuntu 16.04 (where Py2 is set as default):
Py3.png
Py3.png (33.97 KiB) Viewed 1475 times
chrisb
Veteran
Posts: 54303
Joined: Tue Mar 17, 2015 9:14 am

Re: Porting to python3

Post by chrisb »

Are these environment variables to be set? Or does it need to compile FreeCAD?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

chrisb wrote: Mon Jun 11, 2018 6:52 am Are these environment variables to be set? Or does it need to compile FreeCAD?
It needs to be set before compiling FreeCAD (cmake or cmake-gui).
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

chrisb wrote:Are these environment variables to be set? Or does it need to compile FreeCAD?
python is a build and run dependency. Therefor you have to build freecad with a specific python version.
If you are not able to build FreeCAD there are some options to get builds:

windows:
- builds provided by sgrogan. Available on the github release page: https://github.com/FreeCAD/FreeCAD/releases
- install with conda

linux:
- install with conda

osx:
- conda: (waiting for this PR to be merged: https://github.com/conda-forge/staged-recipes/pull/5897)

Installation with conda is in principial the same for all 3 plattforms (64 bit only):
- Install miniconda (64bit /py36): https://conda.io/miniconda.html

Code: Select all

conda config --add channels conda-forge
conda config --add channels freecad
conda create -n freecad freecad
Once the mentioned PR is merged I will try to fork this PR to setup an automatic weekly build to upload to the freecad channel. The idea is to have stable builds on conda-forge channel and most actual on the freecad-channel.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

And what is the glibc version on conda? Could creating AppImage and uploading it to releases page be automated? On a bit unrelated note. Could Windows builds be automated (less work for @sgrogan)?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

triplus wrote:And what is the glibc version on conda?
conda packages depent on the system glibc on linux. So not all distros will work, but most. I test on ubuntu 14.04 - 18.04 and centos 6.
triplus wrote:Could creating AppImage and uploading it to releases page be automated?
Is possible, but as long as delta updates are not working this doesn't make much sense (too big filesize).
Installing a conda-env directly and using

Code: Select all

conda update freecad
# conda update --all  # update all packages
will only update newly uploaded packages. (40mb for freecad)
triplus wrote:On a bit unrelated note. Could Windows builds be automated (less work for @sgrogan)?
I am not sure a fully automated workflow is possible and makes sense. But my plan is to build weekly by increasing the build-number and pushing a PR. The rest is done by the ci's (circle for osx and linux, appveyor for windows)
Opus
Posts: 91
Joined: Wed Nov 08, 2017 5:36 pm

Re: Porting to python3

Post by Opus »

looo wrote:
Hello looo,
I installed Freecad 0.18 PY3 QT5 via conda.
It works !

But, I don't know which is revision number:

Code: Select all

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.Unknown
Build type: Release
Python version: 3.6.5
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: French/France (fr_FR)
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

Opus wrote:But, I don't know which is revision number:
yes I know this problem. Maybe @sgrogan knows whats wrong here. Maybe it's to due some patching? Is git necessary in build and run environment?
sgrogan wrote:
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Post by triplus »

looo wrote: Mon Jun 11, 2018 11:19 am Is possible, but as long as delta updates are not working this doesn't make much sense (too big filesize).
To be honest it's working out without the mentioned feature being available. Sure. It would be great to have that in the future. But highly likely we aren't talking about a deal breaker.
Installing a conda-env directly and using
I see. Adding the Conda instructions here would therefore make some sense?

https://www.freecadweb.org/wiki/Download

P.S. We could i guess be more aggressive and flip the Py3 flags on for Trusty builds. And let that propagate to AppImage. If we decide and do that Py3 related reports will for sure start to come after.
Post Reply