How to start Freecad with Python 3 ?

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
regis
Posts: 747
Joined: Sun Jul 12, 2015 8:17 am
Contact:

How to start Freecad with Python 3 ?

Post by regis »

Hello all, i'm trying to find out how to to start my freecad with python3. I have python 2 and 3 installed by default on my system but every time it launches with python2. Looking for a way to launch freecad with the desired python. How to do that is what i've not been able to figure out.
User avatar
kkremitzki
Veteran
Posts: 2517
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: How to start Freecad with Python 3 ?

Post by kkremitzki »

Depends on how you got the Python 3 version, if it's Debian Unstable do sudo update-alternatives --config freecad and pick the freecad-python3 option.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to start Freecad with Python 3 ?

Post by wmayer »

regis wrote: Sun Feb 17, 2019 4:08 am Hello all, i'm trying to find out how to to start my freecad with python3. I have python 2 and 3 installed by default on my system but every time it launches with python2. Looking for a way to launch freecad with the desired python. How to do that is what i've not been able to figure out.
First of all you need a compiled FreeCAD version that linked against Python3. You cannot have a FreeCAD version linking against Python2 and then all sudden start it with Python3.
User avatar
regis
Posts: 747
Joined: Sun Jul 12, 2015 8:17 am
Contact:

Re: How to start Freecad with Python 3 ?

Post by regis »

kkremitzki wrote: Sun Feb 17, 2019 5:10 am Depends on how you got the Python 3 version, if it's Debian Unstable do sudo update-alternatives --config freecad and pick the freecad-python3 option.
the Python3 version came with the Linux Mint 19.1 by default
OS: Linux Mint 19.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15860 (Git)
Build type: Release
Branch: master
Hash: 3b708c7f84b0425076b520e1d95627b20fd75fe0
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
Screenshot from 2019-02-17 06-03-49.png
Screenshot from 2019-02-17 06-03-49.png (95.38 KiB) Viewed 4329 times
wmayer wrote: Sun Feb 17, 2019 7:23 am First of all you need a compiled FreeCAD version that linked against Python3. You cannot have a FreeCAD version linking against Python2 and then all sudden start it with Python3.
is there a link to any tutorial on how to do that?
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: How to start Freecad with Python 3 ?

Post by wmayer »

Check the CompileOnUnix page in the wiki how to set up a build environment.
Once you run cmake check its output to see which Python version is used. If it still uses Py2 then change the PYTHON_EXECUTABLE variable to point to the Py3 version and rerun cmake.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: How to start Freecad with Python 3 ?

Post by triplus »

If you don't want to compile FreeCAD yourself, you can try out AppImage:

https://github.com/FreeCAD/FreeCAD/releases/

Conda based one offers Py3/Qt5 build and PPA based one Py2/Qt4 build.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: How to start Freecad with Python 3 ?

Post by NormandC »

regis wrote: Sun Feb 17, 2019 11:07 am the Python3 version came with the Linux Mint 19.1 by default
That's impossible. Linux Mint 19.1 is based on Ubuntu 18.04, which still comes with the obsolete 0.16.6712 version.

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

You are most certainly using the freecad-daily PPA; it has not been switched to the update-alternatives version yet, it is still built with Python2 only.

Kurt ported his Debian work on his own PPA last month, but he hasn't updated the package since.

https://launchpad.net/~kkremitzki/+arch ... /+packages

Note that this package will conflict with the freecad_0.15.13541 package from the freecad-stable PPA.
User avatar
regis
Posts: 747
Joined: Sun Jul 12, 2015 8:17 am
Contact:

Re: How to start Freecad with Python 3 ?

Post by regis »

wmayer wrote: Sun Feb 17, 2019 1:03 pm Check the CompileOnUnix page in the wiki how to set up a build environment.
Once you run cmake check its output to see which Python version is used. If it still uses Py2 then change the PYTHON_EXECUTABLE variable to point to the Py3 version and rerun cmake.
Thanks for now this doesn't make much sense.
triplus wrote: Sun Feb 17, 2019 1:59 pm If you don't want to compile FreeCAD yourself, you can try out AppImage:

https://github.com/FreeCAD/FreeCAD/releases/

Conda based one offers Py3/Qt5 build and PPA based one Py2/Qt4 build.
Indeed this worked, but does this appimage account for daily releases aswell?
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: How to start Freecad with Python 3 ?

Post by triplus »

regis wrote: Sun Feb 17, 2019 8:02 pm Indeed this worked, but does this appimage account for daily releases aswell?
PPA based AppImage is in general considered to be a daily one indeed, Conda based AppImage is currently updated weekly (Monday).
Post Reply