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!
Post Reply
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

What is the deal with pivy?

Post by ezzieyguywuf »

I am desperately trying to get my local FreeCAD build to the point that it will pass all of the tests using "./bin/FreeCAD --run-tests 0", however I'm finding that I have quite the issue as it pertains to pivy.

As far as I can tell, Pivy is (was?) a part of the Coin project, which is currently hosted on bitbucket.

The last commit to pivy, though, was merging a change that was made by the FreeCAD community back in August of last year.

Is this project active?

If so, where does one find support? I've seen it mentioned in multiple places that Coin3D in general, and Pivy specifically, may be "dying" projects, and that FreeCAD may be the biggest (only?) project that are using them.

As it stands here is my issue - my OS does not have a pre-packaged version of pivy available. This shouldn't be an issue: I downloaded the source and attempted to build with "python setup.py build" then "python setup.py install".

However, the setup.py fails because it can't find Coin or SoQT using cmake.

Ok...so I use "python setup_old.py build" and then install that. great! However, upon entering an interactive python prompt, I attempt to "import pivy" and am met with:

Code: Select all

>>> import pivy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/wolfie/Program/CAD_dev/pivy/pivy/__init__.py", line 30, in <module>
    from .coin import SoDB, SoNodeKit, SoInteraction
ImportError: cannot import name 'SoDB'
Some research suggests that this could be due to a circular dependency. Oh boy.

Well, I figure maybe the "setup.py" has some fixes that "setup_old.py" does not. So, I edit CMakeLists.txt by adding the following lines:

Code: Select all

set(Coin_FOUND TRUE)
set(Coin_VERSION "3.1.3-r2")
set(Coin_INCLUDE_DIR "/usr/include/coin")
set(Coin_LIB_DIR "/usr/lib64")

set(SoQt_FOUND FALSE)
I read (somewhere) that if SoQt is not found, it just won't be used. Sure enough, this allowed me to build and install using "setup.py" but I still have the same issue when trying to import pivy.

Therefore, in conclusion, TL;DR:

If pivy is so minimally (poorly?) maintained, should we continue to rely on it so heavily?

If not, what are our alternatives?

I'm willing to spend some time helping to transition to something else, for the sake of my own sanity, and for the sake of the community :P
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: What is the deal with pivy?

Post by triplus »

Pivy provides Python binding for Coin3D. Yes, we do need it. For compiling currently you usually do need to patch it. As for migrating to something else. It could be done, but if we start today the migration likely would not be done for some years to come.

https://forum.freecadweb.org/viewtopic.php?f=10&t=35289

Therefore i guess if you can and do want to help, you could contribute to upstream Pivy and try to make the compiling experience more straightforward. From all available options this one still (by far) takes the least amount of effort, at least for now.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: What is the deal with pivy?

Post by jmaustpc »

ezzieyguywuf wrote: Tue Aug 20, 2019 2:25 am my OS does not have a pre-packaged version of pivy available.
Just curious, what is your OS?
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: What is the deal with pivy?

Post by ezzieyguywuf »

Does this thread contain somewhere the necessary patches to make pivy work?
triplus wrote: Tue Aug 20, 2019 11:25 am Therefore i guess if you can and do want to help, you could contribute to upstream Pivy and try to make the compiling experience more straightforward. From all available options this one still (by far) takes the least amount of effort, at least for now.
I'm not too terribly interested in contributing to Coin/Pivy since it seems that both projects (pivy specifically) are for the most part "dead"

Although a longer task, I'd be much more interested in contributing to FreeCAD transitioning to a different library.

I realize it could take years, but, you know, I've been working on topological naming for years too and I still haven't quit :-P
jmaustpc wrote: Tue Aug 20, 2019 11:42 am Just curious, what is your OS?
Gentoo. I know there are overlays available with most (if not all) of what I am missing ,however I have a general distrust of these things and prefer to compile things myself that are not available in the official repositories.
sariug
Posts: 17
Joined: Mon Mar 25, 2019 10:33 am

Re: What is the deal with pivy?

Post by sariug »

I also had problems with pivy before.

If there is a new sceneograph migration progress, I would love to be part of it. ( First came to my mind is VTK and magnum graphics )
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: What is the deal with pivy?

Post by ezzieyguywuf »

sariug wrote: Tue Aug 20, 2019 3:49 pm I also had problems with pivy before.

If there is a new sceneograph migration progress, I would love to be part of it. ( First came to my mind is VTK and magnum graphics )
I wonder what kind of options we have.

After a very cursory internet search, I've found a few things:
  • Ogre3D is an open-source, cross-platform game engine. It has support for OpenGL and Direct3D. It has some sort of scripting language, but not python. Written in C++
  • Pandas3D is an open-source, cross-platform game engine. Seems to support OpenGL and DirectX. It seems that one of the core design goals is to provide python bindings. Written in C++, but primarily intended to be used via python bindings.
  • Blender is an extremely popular and mature open-source, 3D renderin/editing software. It has developed its own 3D engine, called Cycles. It has specific support for CUDA (Nvidia) and OpenCL (AMD) - not really sure what that means, but sounds helpful. It does seem to support python scripting.
  • Godot is an open-source game engine. written in C++, has it's owns GDScript (similar to python)
There's other options too, though - mostly game engines.

Would it be wise to pick one of these more popular, more active projects to build FreeCAD around?

Again, I understand this would be a huge migration, but in the interest of keeping FreeCAD maintainable and keeping development active, I think we'll have to make a change eventually...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: What is the deal with pivy?

Post by triplus »

ezzieyguywuf wrote: Tue Aug 20, 2019 1:37 pm Does this thread contain somewhere the necessary patches to make pivy work?
No. If you are interested in that, best to ask Debian/Conda packagers active here on the forum, they do apply patches.
I'm not too terribly interested in contributing to Coin/Pivy since it seems that both projects (pivy specifically) are for the most part "dead"
They aren't dead.
Although a longer task, I'd be much more interested in contributing to FreeCAD transitioning to a different library.
This is more or less what the linked thread is about.
I realize it could take years, but, you know, I've been working on topological naming for years too and I still haven't quit :-P
That is true but until then Pivy/Coin3D is what everybody using FreeCAD will need. Currently Debian/Conda/Gentoo ... are applying patches manually. Some day maybe situation will therefore improve. And for some perspective, the last big multi year effort just merged, named App::Link, well it's utilizing Coin3D heavily. In addition nobody can predict what will happen with any of the solutions in a few years time. It could happen Coin3D development would gain traction again and the other solution we would choose to stop being as actively developed as it currently is.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: What is the deal with pivy?

Post by Joel_graff »

ezzieyguywuf wrote: Tue Aug 20, 2019 4:46 pm I wonder what kind of options we have.

After a very cursory internet search, I've found a few things:
@triplus is right. Pivy and Coin3D may not be popular, but neither are dead and, Coin3D at least, is pretty solid and it has recently started to get more regular updates from some newer contributors (or so it seems the last time I checked out the source tree).

If we were to transition, we'd probably select a scenegraph library - not a game engine library. To that end, OpenSceneGraph (OSG) would be an ideal candidate, IMO. Nevermind the fact we'd need a Python API for it as well. It's a topic that's been discussed a few times before. :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: What is the deal with pivy?

Post by ezzieyguywuf »

To have a project that cannot be reliably built on one of the target platforms...I dunno, to me that's not a very "live" project.

It would seem that a first priority should be to make the project buildable.
User avatar
kkremitzki
Veteran
Posts: 2515
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: What is the deal with pivy?

Post by kkremitzki »

OpenSceneGraph, at least on Debian, also depends on Coin, btw.
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.
Post Reply