What is the deal with pivy?

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
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: What is the deal with pivy?

Post by adrianinsaval »

Isn't pivy easily installed with pip?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: What is the deal with pivy?

Post by looo »

adrianinsaval wrote: Fri Jan 20, 2023 5:47 pm Isn't pivy easily installed with pip?
Not sure the pypi package is maintained.
User avatar
iplayfast
Posts: 256
Joined: Sat Sep 07, 2019 6:55 am

Re: What is the deal with pivy?

Post by iplayfast »

looo wrote: Fri Jan 20, 2023 5:20 pm What's the problem with compiling pivy? Which system are you using?
The problem isn't compiling so much as it is running the system.
Sample run...

Code: Select all

freecad
FreeCAD 0.21.0, Libs: 0.21.0R31631 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2023
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Assembly4 workbench (v0.12.5) loaded
Sheet Metal workbench loaded
Interlocking laser cut workbench loaded
During initialization the error "module 'pivy._coin' has no attribute 'delete_SoGeo'" occurred in /home/chris/.local/share/FreeCAD/Mod/kicadStepUpMod/./InitGui.py
Please look into the log file for further information
During initialization the error "module 'pivy._coin' has no attribute 'delete_SoGeo'" occurred in /home/chris/.local/share/FreeCAD/Mod/ExplodedAssembly/InitGui.py
Please look into the log file for further information
During initialization the error "module 'pivy._coin' has no attribute 'delete_SoGeo'" occurred in /home/chris/.local/share/FreeCAD/Mod/A2plus/./InitGui.py
Please look into the log file for further information
('Mod/Pyramids_and_polyhedrons', 'Mod/Pyramids-and-Polyhedrons', 'Mod/FreeCAD-Pyramids-and-Polyhedrons', 'Mod/Pyramids-and-polyhedrons')
During initialization the error "module 'pivy._coin' has no attribute 'delete_SoGeo'" occurred in /home/chris/.local/share/FreeCAD/Mod/fasteners/./InitGui.py
Please look into the log file for further information
During initialization the error "module 'pivy._coin' has no attribute 'delete_SoGeo'" occurred in freecad.asm3
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "<string>", line 217, in InitApplications
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/chris/.local/share/FreeCAD/Mod/Assembly3/./freecad/asm3/init_gui.py", line 3, in <module>
    from . import gui
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/home/chris/.local/share/FreeCAD/Mod/Assembly3/./freecad/asm3/gui.py", line 4, in <module>
    from pivy import coin
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pivy/__init__.py", line 30, in <module>
    from .coin import SoDB, SoNodeKit, SoInteraction
  File "/usr/lib/python3/dist-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 142, in _import
    return original_import(name, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 40397, in <module>
    class SoGeo(object):
  File "/usr/lib/python3/dist-packages/pivy/coin.py", line 40431, in SoGeo
    __swig_destroy__ = _coin.delete_SoGeo
AttributeError: module 'pivy._coin' has no attribute 'delete_SoGeo'
--------------------------------------------------------------------------------
connect failed: No such file or directory
My system...

Code: Select all

OS: Linux Mint 21 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.0.31631 (Git)
Build type: Unknown
Branch: master
Hash: ce0391686eef83f538ad2ce3c253f8b2f3b08ee8
Python 3.10.6, Qt 5.15.3, Coin 4.0.1, Vtk 9.1.0, OCC 7.5.1
Locale: English/Canada (en_CA)
Installed mods: 
  * freecad.gears 1.0.0
  * BIM 2021.12.0
  * CycloidGearBox
  * parts_library
  * CurvedShapes 1.0.4
  * SelectorToolbar
  * EM
  * Assembly4 0.12.5
  * ThreadProfile 1.84.0
  * sheetmetal 0.2.60
  * 3D_Printing_Tools
  * ose-piping
  * kicadStepUpMod 10.16.8
  * ExplodedAssembly
  * A2plus 0.4.60h
  * LCInterlocking
  * Assembly3 0.11.4
  * Design456 0.0.1
  * symbols_library
  * Help 1.0.3
  * lattice2 1.0.0
  * FeedsAndSpeeds 0.5.0
  * Pyramids-and-Polyhedrons
  * fasteners 0.4.53
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: What is the deal with pivy?

Post by looo »

related:
https://forum.freecadweb.org/viewtopic.php?f=4&t=74383

maybe this helps:
https://stackoverflow.com/questions/684 ... ute-delete

are you configuring pivy with setup.py or with cmake?
User avatar
iplayfast
Posts: 256
Joined: Sat Sep 07, 2019 6:55 am

Re: What is the deal with pivy?

Post by iplayfast »

looo wrote: Fri Jan 20, 2023 10:36 pm related:
https://forum.freecadweb.org/viewtopic.php?f=4&t=74383
Yup, same bug. I've seen him haunting the same places as me :)
maybe this helps:
https://stackoverflow.com/questions/684 ... ute-delete

are you configuring pivy with setup.py or with cmake?
I think I've tried both. Which should I be using?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: What is the deal with pivy?

Post by looo »

iplayfast wrote: Sat Jan 21, 2023 1:46 am I think I've tried both. Which should I be using?
Cmake is preferred. But actually both should work.

If I read the link I posted correctly you need to delete the old _coin.so. And run the compilation again. There is also the chance you have multiple _coin.so libraries. Can you post the output of this:

Code: Select all

sudo updatedb
locate _coin.so
User avatar
iplayfast
Posts: 256
Joined: Sat Sep 07, 2019 6:55 am

Re: What is the deal with pivy?

Post by iplayfast »

looo wrote: Sat Jan 21, 2023 9:17 am

Code: Select all

sudo updatedb
locate _coin.so
sudo updatedb
chris@shop:~/github/pivy$ locate _coin.so
/usr/lib/python3/dist-packages/pivy/_coin.so

I checked the date, and it's older than my last setup.py which was last night.

After building with cmake

Code: Select all

sudo updatedb
chris@shop:~/github/pivy/build$ locate _coin.so
/home/chris/github/pivy/build/interfaces/_coin.so
/usr/lib/python3/dist-packages/pivy/_coin.so
so It made a difference and the date is current.

Running freecad without recompiling crashes

Code: Select all

FreeCAD 0.21.0, Libs: 0.21.0R31635 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2023
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Assembly4 workbench (v0.12.5) loaded
Sheet Metal workbench loaded
Interlocking laser cut workbench loaded
A3 available
('Mod/Pyramids_and_polyhedrons', 'Mod/Pyramids-and-Polyhedrons', 'Mod/FreeCAD-Pyramids-and-Polyhedrons', 'Mod/Pyramids-and-polyhedrons')
FreeCAD: /home/chris/github/freecad-source/src/Mod/Part/Gui/TaskDimension.cpp:1343: static void PartGui::ArcEngine::initClass(): Assertion `SoEngine::getClassTypeId() != SoType::badType()' failed.
/home/chris/bin/freecad: line 2: 240520 Aborted                 (core dumped) bin/FreeCAD
recompiling freecad made no difference.
Trying a clean make now
Made no difference, crash in same place.
Last edited by iplayfast on Sun Jan 22, 2023 6:36 pm, edited 1 time in total.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: What is the deal with pivy?

Post by looo »

what does this command reports:

Code: Select all

apt list pythoon3-pivy
I suspect that you have pivy installed via the package-manager but want to replace it with a self compiled version. The version from the package-manager doesn't have the SoGeo bindings. (it's version 0.6.5)

Some replaced the important files manually, and I guess this worked.
User avatar
iplayfast
Posts: 256
Joined: Sat Sep 07, 2019 6:55 am

Re: What is the deal with pivy?

Post by iplayfast »

looo wrote: Sun Jan 22, 2023 9:34 am what does this command reports:
*edit, I just realized the typo, NOT pythoon3 :roll: fixed*

Code: Select all

apt list python3-pivy

Code: Select all

apt list python3-pivy
Listing... Done
python3-pivy/jammy,now 0.6.5-1build6 amd64 [installed]
I suspect that you have pivy installed via the package-manager but want to replace it with a self compiled version. The version from the package-manager doesn't have the SoGeo bindings. (it's version 0.6.5)
Some replaced the important files manually, and I guess this worked.
except it didn't.
User avatar
iplayfast
Posts: 256
Joined: Sat Sep 07, 2019 6:55 am

Re: What is the deal with pivy?

Post by iplayfast »

So I've tried using synaptic complete removal of pivy.so and soqt.so, and even went so far as to remove the directories

Code: Select all

/usr/lib/python3/dist-packages$ sudo rm -rf pivy
I then in the pivy/build directory did

Code: Select all

cmake ..
make 
sudo make install
and it seemed to install to Installing: /usr/lib/python3/dist-packages/pivy/
On running freecad (after making it)

Code: Select all

reeCAD: /home/chris/github/freecad-source/src/Mod/Part/Gui/TaskDimension.cpp:1343: static void PartGui::ArcEngine::initClass(): Assertion `SoEngine::getClassTypeId() != SoType::badType()' failed.
/home/chris/bin/freecad: line 2: 89991 Aborted                 (core dumped) bin/FreeCAD
I've tried recompiling fresh from @realthunder's coin, and fresh from the original coin3d coin.
In every case I'm getting the same crash.

so I'm obviously missing a step here.

I'm sorry to be such a newb, but how would you take a fresh linux install, and install and build freecad from source? I can't seem to do it anymore.
Post Reply