pivy icon indicating copy to clipboard operation
pivy copied to clipboard

circular import error

Open iplayfast opened this issue 2 years ago • 16 comments

I've just cloned and installed coin, I then cloned and installed pivy. trying to import pivy gives.

python Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import pivy Traceback (most recent call last): File "", line 1, in File "/home/chris/github/pivy/build/pivy/init.py", line 30, in from .coin import SoDB, SoNodeKit, SoInteraction File "/home/chris/github/pivy/build/pivy/coin.py", line 21, in from . import _coin ImportError: cannot import name '_coin' from partially initialized module 'pivy' (most likely due to a circular import) (/home/chris/github/pivy/build/pivy/init.py)

iplayfast avatar Jan 13 '23 18:01 iplayfast

maybe you can try to run python from the home-directory. If you have installed pivy python should use the installed version.

looooo avatar Jan 13 '23 18:01 looooo

To be clear. I cloned and installed coin, (cd build;cmake ..;make;sudo make install). Then cloned and installed pivy (cd build;cmake ..;make;sudo make install). So should be a clean fresh install.

Going to a new terminal (directory is ~) I typed python import pivy

and got the error.

Did you try and find a different result?

iplayfast avatar Jan 13 '23 19:01 iplayfast

I am having the same problem. Downloaded and installed coin, soqt and quarter from sources per instructions in INSTALL and did not have any errors. Using the compile/install instructions for pivy I see the same problem ` ~/Downloads/Coin3D/pivy/build$ cmake .. -- COIN_FOUND: TRUE -- COIN_INCLUDE_DIR: /usr/local/include -- COIN_LIB_DIR: /usr/local/lib -- COIN_VERSION: 4.0.1 CMake Warning at /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package): By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Core", but CMake did not find one.

Could not find a package configuration file provided by "Qt5Core" with any of the following names:

Qt5CoreConfig.cmake
qt5core-config.cmake

Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set "Qt5Core_DIR" to a directory containing one of the above files. If "Qt5Core" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): /usr/local/lib/cmake/SoQt-1.6.0/soqt-config.cmake:65 (find_dependency) CMakeLists.txt:15 (find_package)

CMake Warning at CMakeLists.txt:15 (find_package): Found package configuration file:

/usr/local/lib/cmake/SoQt-1.6.0/soqt-config.cmake

but it set SoQt_FOUND to FALSE so package "SoQt" is considered to be NOT FOUND. Reason given by package:

SoQt could not be found because dependency Qt5Core could not be found.

-- Configuring done -- Generating done -- Build files have been written to: ~/Downloads/Coin3D/pivy Then:Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import pivy Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3/dist-packages/pivy/init.py", line 30, in from .coin import SoDB, SoNodeKit, SoInteraction File "/usr/lib/python3/dist-packages/pivy/coin.py", line 40333, in class SoGeo(object): File "/usr/lib/python3/dist-packages/pivy/coin.py", line 40367, in SoGeo swig_destroy = _coin.delete_SoGeo AttributeError: module 'pivy._coin' has no attribute 'delete_SoGeo'

`

mconsidine avatar Jan 26 '23 14:01 mconsidine

This happened to me when I tried import pivy while the the current working directory was the build directory. I went up a couple of directories to the one above where I cloned pivy, and then it imported fine..

foobarbecue avatar Dec 05 '23 00:12 foobarbecue

But then, from pivy import coin failed. Actually, I can't find enough documentation to use this at all.

foobarbecue avatar Dec 05 '23 00:12 foobarbecue

Aha, I had to run sudo make install. That's missing from the README.

foobarbecue avatar Dec 05 '23 00:12 foobarbecue

So I tried to run examples/examiner_embed.py and I get ModuleNotFoundError: No module named 'pivy.gui.soqt'

foobarbecue avatar Dec 05 '23 00:12 foobarbecue

@foobarbecue if soqt is not found pivy is build without soqt-support. Maybe this is the case here

looooo avatar Dec 05 '23 16:12 looooo

Could someone make a quick dockerfile that shows how to install and run this to the point that any of the examples work? Otherwise, it's just too much guesswork.

foobarbecue avatar Dec 09 '23 17:12 foobarbecue

using conda is no option for you?

conda create -n pivy coin3d soqt cmake swig -c conda-forge
conda activate pivy
git clone https://github.com/coin3d/pivy.git
cd pivy
mkdir build
cd build
cmake ..
make install
... run examples

or installing pivy directly with conda:

conda create -n pivy pivy -c conda-forge
conda activate pivy
... run examples

looooo avatar Dec 09 '23 17:12 looooo

@looooo great to hear it's on conda -- I had no idea! I installed pivy through conda. Now, how do I "... run examples" exactly?

foobarbecue avatar Dec 10 '23 03:12 foobarbecue

Ok, I installed pivy through conda, activated that conda environment, cloned this repo and then tried running the python files in pivy/examples/Mentor/ . I got a GUI window! However, it's always blank:

image

foobarbecue avatar Dec 10 '23 03:12 foobarbecue

(pivy) aacurtis@MT-405357:~/pivy/examples/Quarter$ ./minimal.py
Traceback (most recent call last):
  File "/home/aacurtis/pivy/examples/Quarter/./minimal.py", line 21, in <module>
    from pivy.qt.QtWidgets import QApplication
ModuleNotFoundError: No module named 'pivy.qt'

foobarbecue avatar Dec 10 '23 03:12 foobarbecue

Ok I tried the stuff in pivy/examples/Mentor/ after installing pivy using conda on a Debian 12 system. The above is Ubuntu on WSL2 on Windows. Normally that works fine for graphical linux things.

Anyway, I could try making a debian 12 dockerfile and see if it works on WSL and then maybe that would be worth including in this repo.

foobarbecue avatar Dec 10 '23 04:12 foobarbecue

(pivy) aacurtis@MT-405357:~/pivy/examples/Quarter$ ./minimal.py
Traceback (most recent call last):
  File "/home/aacurtis/pivy/examples/Quarter/./minimal.py", line 21, in <module>
    from pivy.qt.QtWidgets import QApplication
ModuleNotFoundError: No module named 'pivy.qt'

The repo was updated to work with pyside6 and pyside2. But the conda build is older and doesn't take this change into account.

looooo avatar Dec 10 '23 07:12 looooo

I too am having a lot of difficulty building pivy. I have already built and installed coin, soqt, quarter and soxt without issues. The CMake options fails because of what appears to the a QT bug

 COIN_FOUND: TRUE
 COIN_INCLUDE_DIR: /usr/local/include
 COIN_LIB_DIR: /usr/local/lib
 COIN_VERSION: 4.0.2
 CMake Error at /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/FindThreads.cmake:62 (message):
   FindThreads only works if either C or CXX language is enabled
 Call Stack (most recent call first):
   /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:36 (find_dependency)
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6/Qt6Dependencies.cmake:24 (_qt_internal_find_third_party_dependencies)
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6/Qt6Config.cmake:111 (include)
   /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:17 (find_dependency)
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake:41 (include)
   /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
   /usr/local/lib/cmake/SoQt-1.6.1/soqt-config.cmake:60 (find_dependency)
   CMakeLists.txt:15 (find_package)

 CMake Warning at /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
   Found package configuration file:

     /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6/Qt6Config.cmake

   but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
   FOUND.
 Call Stack (most recent call first):
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:17 (find_dependency)
   /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake:41 (include)
   /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
   /usr/local/lib/cmake/SoQt-1.6.1/soqt-config.cmake:60 (find_dependency)
   CMakeLists.txt:15 (find_package)

 CMake Warning at /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
   Found package configuration file:

     /home/olumide/Qt6/6.6.1/gcc_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake

   but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be
   NOT FOUND.
 Call Stack (most recent call first):
   /usr/local/lib/cmake/SoQt-1.6.1/soqt-config.cmake:60 (find_dependency)
   CMakeLists.txt:15 (find_package)

 Configuring incomplete, errors occurred!
 See also "/home/olumide/Downloads/src/pivy/CMakeFiles/CMakeOutput.log".

The setup.py option appeared to compile successfully but after a lengthy warning

CMake Warning at /opt/cmake-3.19.1-Linux-x86_64/share/cmake-3.19/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "FindQt6Core.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6Core", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6Core" with any
  of the following names:

    Qt6CoreConfig.cmake
    qt6core-config.cmake

  Add the installation prefix of "Qt6Core" to CMAKE_PREFIX_PATH or set
  "Qt6Core_DIR" to a directory containing one of the above files.  If
  "Qt6Core" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  /usr/local/lib/cmake/SoQt-1.6.1/soqt-config.cmake:60 (find_dependency)
  CMakeLists.txt:15 (find_package)


CMake Warning at CMakeLists.txt:15 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/SoQt-1.6.1/soqt-config.cmake

  but it set SoQt_FOUND to FALSE so package "SoQt" is considered to be NOT
  FOUND.  Reason given by package:

  SoQt could not be found because dependency Qt6Core could not be found

Unfortunately the build appears to incomplete, as shown below:

>>> from pivy.qt import QtWidgets
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pivy.qt'

olumide-x avatar Dec 16 '23 06:12 olumide-x