can not import vtk when build in master brach

when build vtk with python3.10.12 at commit 0288764b4b on ubuntu 22.04.4, build is ok, but when import vtk in python, raise error as follows

In [1]: import vtk
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 import vtk

File ~/projects/packages/vtk/desktop/install/lib/python3.10/site-packages/vtk.py:4
      1 """This is the vtk module"""
      3 # this module has the same contents as vtkmodules.all
----> 4 from vtkmodules.vtkCommonCore import *
      5 from vtkmodules.vtkCommonMath import *
      6 from vtkmodules.vtkCommonTransforms import *

ImportError: /home/xxx/projects/packages/vtk/desktop/install/lib/python3.10/site-packages/vtkmodules/vtkCommonCore.cpython-310-x86_64-linux-gnu.so: undefined symbol: _ZN19vtkIndexedLongArray11ExtendedNewEv

This sounds related to:

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11026

Cc: @nicolas.vuaille @lgivord @Louis_Gombert

Seem to work fine with Python 3.11 here.

Could be that there’s some CMake option that makes the wrappers see a header but it isn’t built?

No idea here …

Also note that the python3.10 wheel jobs works as expected: TestImplicitArrayInstanciation passes on 2024-05-02 date bump commit https://gitlab.kitware.com/vtk/vtk/-/jobs/9703610

I test it on Python3.12.3, but failed.

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/xxx/projects/packages/vtk/desktop/install/lib/python3.12/site-packages/vtk.py", line 4, in <module>
    from vtkmodules.vtkCommonCore import *
ImportError: /home/xxx/projects/packages/vtk/desktop/install/lib/python3.12/site-packages/vtkmodules/vtkCommonCore.cpython-312-x86_64-linux-gnu.so: undefined symbol: _ZN19vtkIndexedLongArray11ExtendedNewEv

I will change to python3.11, and test it. thanks for this info.

 python3 -m vtk
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/xxx/projects/packages/vtk/desktop/install/lib/python3.11/site-packages/vtk.py", line 4, in <module>
    from vtkmodules.vtkCommonCore import *
ImportError: /home/xxx/projects/packages/vtk/desktop/install/lib/python3.11/site-packages/vtkmodules/vtkCommonCore.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZN19vtkIndexedLongArray11ExtendedNewEv

python3.11 also has this issue.

How did you install VTK ?

sorry,my problem.

when i make a new build folder then build with python3.10-12, then eveything is ok. this undefined symbol _ZN19vtkIndexedLongArray11ExtendedNewEv is gone.

thanks for this can not import vtk when build in master brach - #3 by mwestphal info.