python 3.10

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
memfis
Posts: 588
Joined: Tue Nov 15, 2016 7:58 pm

python 3.10

Post by memfis »

Colleagues. With outward signs of "assembly and installation = OK" there is a problem. When trying to create a new job in the Path workbench, we get an abort. Probably the reason is that Arch is already on python3.10. At any rate, the error is

What are your opinions?

Code: Select all


Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 133, in attach
    self.axs = coin.SoType.fromName("SoAxisCrossKit").createInstance()
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 491, in createInstance
    return _coin.SoType_createInstance(self)
<class 'SystemError'>: <built-in function SoType_createInstance> returned a result with an exception set
Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 133, in attach
    self.axs = coin.SoType.fromName("SoAxisCrossKit").createInstance()
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 491, in createInstance
    return _coin.SoType_createInstance(self)
<class 'SystemError'>: <built-in function SoType_createInstance> returned a result with an exception set
Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 133, in attach
    self.axs = coin.SoType.fromName("SoAxisCrossKit").createInstance()
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 491, in createInstance
    return _coin.SoType_createInstance(self)
<class 'SystemError'>: <built-in function SoType_createInstance> returned a result with an exception set
Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 133, in attach
    self.axs = coin.SoType.fromName("SoAxisCrossKit").createInstance()
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 491, in createInstance
    return _coin.SoType_createInstance(self)
<class 'SystemError'>: <built-in function SoType_createInstance> returned a result with an exception set
PathJobGui.ERROR: <built-in function SoFieldContainer_getField> returned a result with an exception set
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 1565, in Create
    obj.ViewObject.Proxy.editObject(obj.Stock)
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 194, in editObject
    return self.openTaskPanel("Stock")
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 178, in openTaskPanel
    self.showOriginAxis(True)
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 156, in showOriginAxis
    self.switch.whichChild = sw
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 3998, in __setattr__
    field = self.getField(name)
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 3873, in getField
    return _coin.SoFieldContainer_getField(self, name)
SystemError: <built-in function SoFieldContainer_getField> returned a result with an exception set
Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 667, in accept
    self.preCleanup()
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 662, in preCleanup
    self.vproxy.resetEditVisibility(self.obj)
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 273, in resetEditVisibility
    for base in obj.Model.Group:
<class 'ReferenceError'>: Cannot access attribute 'Model' of deleted object

User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: python 3.10

Post by onekk »

At least with an AppIMage of 0.20
OS: Artix Linux (openbox)
Word size of FreeCAD: 64-bit
Version: 0.20.26498 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 1895593)
Hash: 18955931c7f0926a4cd9d2719be5a433b49ae56e
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.3
Locale: Italian/Italy (it_IT)
Path is working.

Probably could be related not to Arch that is using 3.10 (I don't know even if it is possible to "compile" different part of FreeCAD with different Python versions) Python is not compiled, maybe if whole FreeCAD is compiled using a Python version 3.10 some code could not be correctly written for some 3.10 new or modified methods.

From the error it seems that the "model" is having some problem as it is deleted when trying to access obj.Model.

Code: Select all

  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 273, in resetEditVisibility
    for base in obj.Model.Group:
<class 'ReferenceError'>: Cannot access attribute 'Model' of deleted object
Maybe if you post the file that create the error and a description of the Gui operation you are using, someone could test against latest development AppImage.

Or maybe trying to recompile (if you have compiled it by yourself), and retest, as maybe some PR was applied and has temporarily broken something, when using directly GitHub sources there is some risk that similar thing will happen.


Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: python 3.10

Post by looo »

just as a reference: there is also an issue with pivy and python3.10:
https://github.com/coin3d/pivy/issues/88
memfis
Posts: 588
Joined: Tue Nov 15, 2016 7:58 pm

Re: python 3.10

Post by memfis »

The simplest way is to create a new file, create a cylinder, and try to create a path job for the cylinder. Errors occur during creation -
Снимок экрана от 2021-12-16 23-16-58.jpg
Снимок экрана от 2021-12-16 23-16-58.jpg (255.35 KiB) Viewed 5334 times

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 133, in attach
    self.axs = coin.SoType.fromName("SoAxisCrossKit").createInstance()
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 491, in createInstance
    return _coin.SoType_createInstance(self)
<class 'SystemError'>: <built-in function SoType_createInstance> returned a result with an exception set
PathJobGui.ERROR: <built-in function SoFieldContainer_getField> returned a result with an exception set
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 1565, in Create
    obj.ViewObject.Proxy.editObject(obj.Stock)
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 194, in editObject
    return self.openTaskPanel("Stock")
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 178, in openTaskPanel
    self.showOriginAxis(True)
  File "/usr/lib/freecad/Mod/Path/PathScripts/PathJobGui.py", line 156, in showOriginAxis
    self.switch.whichChild = sw
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 3998, in __setattr__
    field = self.getField(name)
  File "/usr/lib/python3.10/site-packages/pivy/coin.py", line 3873, in getField
    return _coin.SoFieldContainer_getField(self, name)
SystemError: <built-in function SoFieldContainer_getField> returned a result with an exception set


Снимок экрана от 2021-12-16 23-17-03.jpg
Снимок экрана от 2021-12-16 23-17-03.jpg (220.46 KiB) Viewed 5334 times
In Apimage everything works fine.

Until yesterday, everything worked almost fine for me too. I only had a three-dimensional operations button with no options to choose from. It has been hypothesized that you need to recompile opencamlib after updating python. So when I recompiled it and installed it, the 3-d button became "as it should", but the whole path workbench stopped working at all.

I tried also to unpack appimage and take Path module from there = same result.
Attachments
errp10.FCStd
(5.75 KiB) Downloaded 65 times
User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: python 3.10

Post by onekk »

So you have no answared main question:

Are you compiling FreeCAD by yourself?

I doubt that 3.10 is supported as @loo has told that there is known problem with pivy that is an important part of FreeCAD.

I've had some problems in Arch Linux too, as on board pythonn3 has became 3.10 and something is broken, sadly it is emacs editor and some related add-ons for coding.

I suppose we have to wait some time to use 3.10 in FreeCAD.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
DarioP
Posts: 15
Joined: Sun Nov 29, 2020 9:19 pm

Re: python 3.10

Post by DarioP »

I am also plagued by python 3.10 on Arch. FreeCAD throws pivy errors on so many operations.
Python 3.9 is available from AUR but I have not find a way to force FreeCAD to use it.
User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: python 3.10

Post by onekk »

I'm using AppImages on Arch Linux, that have Python10 on board, and I have no problem at all.

I think that you could try maybe a virtualenv for FreeCAD, or maybe some anaconda install.

Sadly using "bleeding edge" distributions, (Arch Linux is one of the most quick to adopt new libraries), but the alternative to use "Debian derivatives" or "red Hat" derivative, could lead to problems related to "too old" libraries, as some of them use maybe Python 3.6.9 that is "slightly" old in respect to Python 3.9.7 (I think one of the latest used by FreeCAD).

As usual, there is no "perfect" solution, some developers use even Virtual Machine images, but I don't know as I have not used such "advanced" way.

Maybe asking some advices in "Installing/Compiling" section, will give you some more advices.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
nOOb
Posts: 9
Joined: Sun Apr 18, 2021 9:25 pm

Re: python 3.10

Post by nOOb »

onekk wrote: Mon Jan 03, 2022 12:50 pm I'm using AppImages on Arch Linux, that have Python10 on board, and I have no problem at all.

I think that you could try maybe a virtualenv for FreeCAD, or maybe some anaconda install.

Sadly using "bleeding edge" distributions, (Arch Linux is one of the most quick to adopt new libraries), but the alternative to use "Debian derivatives" or "red Hat" derivative, could lead to problems related to "too old" libraries, as some of them use maybe Python 3.6.9 that is "slightly" old in respect to Python 3.9.7 (I think one of the latest used by FreeCAD).

As usual, there is no "perfect" solution, some developers use even Virtual Machine images, but I don't know as I have not used such "advanced" way.

Maybe asking some advices in "Installing/Compiling" section, will give you some more advices.

Regards

Carlo D.
but can you install macros with app image?
User avatar
onekk
Veteran
Posts: 6199
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: python 3.10

Post by onekk »

Yes it is not a problem, as Macros go in the user directory so no problem at all, I have installed AddOns and Macro without problem, and I use exclusively AppImages, as I'm on Arch Linux.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply