SCIInstitute / ITKCleaver

Wrapper for Cleaver to use as an ITK filter
https://itk-wasm-cleaver-typescript-docs.netlify.app/#/
MIT License
4 stars 4 forks source link

PyCapsule_Import "_ITKCommonPython._C_API" is not valid #22

Closed binyang424 closed 1 year ago

binyang424 commented 2 years ago

Successfully installed itk-5.3rc4.post2 itk-cleaver-1.2.0 itk-core-5.3rc4.post2 itk-io-5.3rc4.post2 itk-numerics-5.3rc4.post2 itk-segmentation-5.3rc4.post2

pip: pip in c:\users\aq84510\appdata\local\programs\python\python310\lib\site-packages (22.2.2)

python: 3.9.7

import itk
image = itk.imread(r'C:\Users\AQ84510\Downloads\spheres1.nrrd')

tet_mesh, triangle_mesh = itk.cleaver_image_to_mesh_filter(image)

itk.meshwrite(triangle_mesh, r'C:\Users\AQ84510\Downloads\triangle_mesh.vtk')

Error:

Traceback (most recent call last):

File "C:\Users\AQ84510.spyder-py3\temp.py", line 5, in tet_mesh, triangle_mesh = itk.cleaver_image_to_mesh_filter(image)

File "C:\Users\AQ84510\Anaconda3\lib\site-packages\itk\support\lazy.py", line 138, in getattribute base.itk_load_swig_module(module, namespace)

File "C:\Users\AQ84510\Anaconda3\lib\site-packages\itk\support\base.py", line 132, in itk_load_swig_module l_module = loader.load(swig_module_name)

File "C:\Users\AQ84510\Anaconda3\lib\site-packages\itk\support\base.py", line 291, in load l_spec.loader.exec_module(l_module) # pytype: disable=attribute-error

File "", line 850, in exec_module

File "", line 228, in _call_with_frames_removed

File "C:\Users\AQ84510\Anaconda3\lib\site-packages\itk\support..\CleaverPython.py", line 13, in from . import _CleaverPython

AttributeError: PyCapsule_Import "_ITKCommonPython._C_API" is not valid

dzenanz commented 2 years ago

This is a duplicate of https://github.com/InsightSoftwareConsortium/ITK/issues/3528. This module will need to be updated to use itk-5.3rc4.post2. Until then, using an earlier version of ITK (e.g. maybe itk-5.3rc4.post1 or itk-5.3rc3) should work.

thewtex commented 1 year ago

@binyang424 thank you for the report. Please upgrade to itk-cleaver-1.3.0, which will resolve the issue.