File “/tmp/tmpcc47w85c/wheel/platlib/dualcellspaces/init.py”, line 2, in
from .dualcellspaces import *
ImportError: generic_type: type “H1DualCells” referenced unknown base type “ngcomp::FESpace”
CMake Error at /tmp/tmpcc47w85c/build/cmake_install.cmake:120 (file):
file INSTALL cannot find “/tmp/tmpcc47w85c/build/stubs/dualcellspaces”: No
such file or directory.
I tried both with the CMake and the pip installation, but both resulted in the same error. Is seems like the dualspaces file does not exist. Is it an error in the package?
It still seems like an issue with stubgen. When using CMake to compile you can omit using it by commenting out the last line in the CMakeLists.txt, i.e.,
Thanks, I did as you suggested and it compiled. When I tried python -m dualcellspaces.demos.test_spaces I got this problem:
python -m dualcellspaces.demos.test_spaces
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 112, in _get_module_details
File "./.venv/lib/python3.12/site-packages/dualcellspaces/__init__.py", line 2, in <module>
from .dualcellspaces import *
ImportError: generic_type: type "H1DualCells" referenced unknown base type "ngcomp::FESpace"
The error suggests that NGSolve and dualcellspaces where compiled with incompatible compilers or compiler flags (meaning, they are considered incompatible by pybind11).
ImportError: generic_type: type “H1DualCells” referenced unknown base type “ngcomp::FESpace”
This means that pybind11 wants to export the type H1DualCells, but the base class ngcomp::FESpace was not exported yet.
Which compiler do you use to build dualcellspaces, do you have CXX environment variables set?
The ngsolve pip package (I assume u used that one?) is built with gcc.
I had not set CXX, seems like it used /usr/bin/c++ by default. I tried to use gcc now. However, I got the same error:
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/gcc
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/gcc
-- Check for working CXX compiler: /usr/bin/gcc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: ~/.venv/bin/python3 (found version "3.12.8") found components: Interpreter Development
-- Found Netgen: ~/.venv/lib/cmake/netgen
-- Install dir: ~/.venv
-- Configuring done
-- Generating done
-- Build files have been written to: ~/dcm/build
: ~/dcm/build$ make CXX=/usr/bin/gcc -j4 install
Scanning dependencies of target dualcellspaces
[ 10%] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1primalcells.cpp.o
[ 20%] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1dualcells3d.cpp.o
[ 30%] Building CXX object CMakeFiles/dualcellspaces.dir/src/dualcellspaces.cpp.o
[ 40%] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1dualcells.cpp.o
[ 50%] Building CXX object CMakeFiles/dualcellspaces.dir/src/hcurldualcells.cpp.o
[ 60%] Building CXX object CMakeFiles/dualcellspaces.dir/src/hcurlprimalcells.cpp.o
[ 70%] Building CXX object CMakeFiles/dualcellspaces.dir/src/hdivprimalcells.cpp.o
[ 80%] Building CXX object CMakeFiles/dualcellspaces.dir/src/intrules.cpp.o
[ 90%] Building CXX object CMakeFiles/dualcellspaces.dir/src/supersparse.cpp.o
[100%] Linking CXX shared library dualcellspaces.so
[100%] Built target dualcellspaces
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: ~/.venv/lib/python3.12/site-packages/dualcellspaces/dualcellspaces.so
-- Set runtime path of "~/.venv/lib/python3.12/site-packages/dualcellspaces/dualcellspaces.so" to ""
-- Up-to-date: ~/.venv/lib/python3.12/site-packages/dualcellspaces/__init__.py
-- Up-to-date:~/.venv/lib/python3.12/site-packages/dualcellspaces/demos/dc_intrules.py
-- Up-to-date: ~/.venv/lib/python3.12/site-packages/dualcellspaces/demos/test_spaces.py
~/dcm/build$ python -m dualcellspaces.demos.dc_intrules
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 112, in _get_module_details
ImportError: generic_type: type "H1DualCells" referenced unknown base type "ngcomp::FESpace"
pip install git+https://github.com/NGSolve/dcm.git
…
Building wheels for collected packages: dualcellspaces
Building wheel for dualcellspaces (pyproject.toml) … error
error: subprocess-exited-with-error
× Building wheel for dualcellspaces (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [69 lines of output]
2024-12-11 16:11:05,591 - scikit_build_core - WARNING - cmake should not be in build-system.requires - scikit-build-core will inject it as needed
*** scikit-build-core 0.10.7 using CMake 3.31.1 (wheel)
*** Configuring CMake…
loading initial cache file /tmp/tmpyn75i9dd/build/CMakeInit.txt
– The C compiler identification is GNU 9.4.0
– The CXX compiler identification is GNU 9.4.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/gcc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/g++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Found Python3: /mnt/samsung4tb/pyNgsDCM/bin/python3 (found version “3.12.8”) found components: Interpreter Development.Module
– Found Netgen: /tmp/pip-build-env-t6ovyl2v/overlay/lib/cmake/netgen
– Install dir: /tmp/tmpyn75i9dd/wheel/platlib
– Configuring done (1.6s)
– Generating done (0.0s)
– Build files have been written to: /tmp/tmpyn75i9dd/build
*** Building project with Ninja…
[1/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/supersparse.cpp.o
[2/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/intrules.cpp.o
[3/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1dualcells3d.cpp.o
[4/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1dualcells.cpp.o
[5/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1primalcells.cpp.o
[6/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/hcurlprimalcells.cpp.o
[7/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/hdivprimalcells.cpp.o
[8/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/dualcellspaces.cpp.o
[9/10] Building CXX object CMakeFiles/dualcellspaces.dir/src/hcurldualcells.cpp.o
[10/10] Linking CXX shared library dualcellspaces.so
*** Installing project into wheel…
– Install configuration: “Release”
– Installing: /tmp/tmpyn75i9dd/wheel/platlib/dualcellspaces/dualcellspaces.so
– Set non-toolchain portion of runtime path of “/tmp/tmpyn75i9dd/wheel/platlib/dualcellspaces/dualcellspaces.so” to “”
– Installing: /tmp/tmpyn75i9dd/wheel/platlib/dualcellspaces/init.py
– Installing: /tmp/tmpyn75i9dd/wheel/platlib/dualcellspaces/demos/dc_intrules.py
– Installing: /tmp/tmpyn75i9dd/wheel/platlib/dualcellspaces/demos/test_spaces.py
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in _run_code
File “/tmp/pip-build-env-t6ovyl2v/overlay/lib/python3.12/site-packages/pybind11_stubgen/main.py”, line 4, in
main()
File “/tmp/pip-build-env-t6ovyl2v/overlay/lib/python3.12/site-packages/pybind11_stubgen/init.py”, line 319, in main
run(
File “/tmp/pip-build-env-t6ovyl2v/overlay/lib/python3.12/site-packages/pybind11_stubgen/init.py”, line 358, in run
QualifiedName.from_str(module_name), importlib.import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “~/.pyenv/versions/3.12.8/lib/python3.12/importlib/init.py”, line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1387, in _gcd_import
File “”, line 1360, in _find_and_load
File “”, line 1331, in _find_and_load_unlocked
File “”, line 935, in _load_unlocked
File “”, line 999, in exec_module
File “”, line 488, in _call_with_frames_removed
File “/tmp/tmpyn75i9dd/wheel/platlib/dualcellspaces/init.py”, line 2, in
from .dualcellspaces import *
ImportError: generic_type: type “H1DualCells” referenced unknown base type “ngcomp::FESpace”
CMake Error at /tmp/tmpyn75i9dd/build/cmake_install.cmake:129 (file):
file INSTALL cannot find “/tmp/tmpyn75i9dd/build/stubs/dualcellspaces”: No
such file or directory.
*** CMake install failed
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dualcellspaces
Failed to build dualcellspaces
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dualcellspaces)
Which OS are you running (and which version)? g++ or gcc doesn’t matter, both are fine. I was meaning other compiler suites than the gcc suite (clang for instance).
Maybe it’s about the compiler version, I will try to reproduce this once I know your OS.
One more question:
How did you install NGSolve? I think it’s using different versions of NGSolve when building the plugin and at run time (due to build-isolation).
Output from python -m pip install --no-build-isolation git+https://github.com/NGSolve/dcm.git:
Building wheels for collected packages: dualcellspaces
Building wheel for dualcellspaces (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for dualcellspaces (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [73 lines of output]
2024-12-12 09:53:34,532 - scikit_build_core - WARNING - cmake should not be in build-system.requires - scikit-build-core will inject it as needed
*** scikit-build-core 0.10.7 using CMake 3.16.3 (wheel)
*** Configuring CMake...
loading initial cache file /tmp/tmpm1k8aiiw/build/CMakeInit.txt
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: /mnt/samsung4tb/pyNgsDCM2/bin/python (found version "3.12.8") found components: Interpreter Development Development.Module Development.Embed
-- Found Netgen: /mnt/samsung4tb/pyNgsDCM2/lib/cmake/netgen
-- Install dir: /tmp/tmpm1k8aiiw/wheel/platlib
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/tmpm1k8aiiw/build
*** Building project with Unix Makefiles...
Scanning dependencies of target dualcellspaces
[ 10%] Building CXX object CMakeFiles/dualcellspaces.dir/src/dualcellspaces.cpp.o
[ 20%] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1dualcells.cpp.o
[ 30%] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1dualcells3d.cpp.o
[ 40%] Building CXX object CMakeFiles/dualcellspaces.dir/src/h1primalcells.cpp.o
[ 50%] Building CXX object CMakeFiles/dualcellspaces.dir/src/hcurldualcells.cpp.o
[ 60%] Building CXX object CMakeFiles/dualcellspaces.dir/src/hcurlprimalcells.cpp.o
[ 70%] Building CXX object CMakeFiles/dualcellspaces.dir/src/hdivprimalcells.cpp.o
[ 80%] Building CXX object CMakeFiles/dualcellspaces.dir/src/intrules.cpp.o
[ 90%] Building CXX object CMakeFiles/dualcellspaces.dir/src/supersparse.cpp.o
[100%] Linking CXX shared library dualcellspaces.so
[100%] Built target dualcellspaces
*** Installing project into wheel...
-- Install configuration: "Release"
-- Installing: /tmp/tmpm1k8aiiw/wheel/platlib/dualcellspaces/dualcellspaces.so
-- Set runtime path of "/tmp/tmpm1k8aiiw/wheel/platlib/dualcellspaces/dualcellspaces.so" to ""
-- Installing: /tmp/tmpm1k8aiiw/wheel/platlib/dualcellspaces/__init__.py
-- Installing: /tmp/tmpm1k8aiiw/wheel/platlib/dualcellspaces/demos/dc_intrules.py
-- Installing: /tmp/tmpm1k8aiiw/wheel/platlib/dualcellspaces/demos/test_spaces.py
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/mnt/samsung4tb/pyNgsDCM2/lib/python3.12/site-packages/pybind11_stubgen/__main__.py", line 4, in <module>
main()
File "/mnt/samsung4tb/pyNgsDCM2/lib/python3.12/site-packages/pybind11_stubgen/__init__.py", line 319, in main
run(
File "/mnt/samsung4tb/pyNgsDCM2/lib/python3.12/site-packages/pybind11_stubgen/__init__.py", line 358, in run
QualifiedName.from_str(module_name), importlib.import_module(module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/.pyenv/versions/3.12.8/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 999, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/tmp/tmpm1k8aiiw/wheel/platlib/dualcellspaces/__init__.py", line 2, in <module>
from .dualcellspaces import *
ImportError: generic_type: type "H1DualCells" referenced unknown base type "ngcomp::FESpace"
CMake Error at /tmp/tmpm1k8aiiw/build/cmake_install.cmake:120 (file):
file INSTALL cannot find "/tmp/tmpm1k8aiiw/build/stubs/dualcellspaces": No
such file or directory.
*** CMake install failed
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for dualcellspaces
Failed to build dualcellspaces
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dualcellspaces)