I want to use CPython C API but still got this [component_container-1] Traceback (most recent call last): [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/core/__init__.py", line 24, in <module> [component_container-1] from . import multiarray [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/core/multiarray.py", line 10, in <module> [component_container-1] from . import overrides [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/core/overrides.py", line 8, in <module> [component_container-1] from numpy.core._multiarray_umath import ( [component_container-1] ImportError: /usr/local/lib/python3.10/dist-packages/numpy/core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so: undefined symbol: PyObject_SelfIter [component_container-1] [component_container-1] During handling of the above exception, another exception occurred: [component_container-1] [component_container-1] Traceback (most recent call last): [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/__init__.py", line 130, in <module> [component_container-1] from numpy.__config__ import show as show_config [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/__config__.py", line 4, in <module> [component_container-1] from numpy.core._multiarray_umath import ( [component_container-1] File "/usr/local/lib/python3.10/dist-packages/numpy/core/__init__.py", line 50, in <module> [component_container-1] raise ImportError(msg) [component_container-1] ImportError: my current cmakelist file set(My_Python_Version "3.10") find_package(Python ${My_Python_Version} EXACT COMPONENTS Interpreter Development NumPy REQUIRED) message(STATUS "Using Python: ${Python_EXECUTABLE}") message(STATUS "Python include: ${Python_INCLUDE_DIRS}") message(STATUS "Python numpy include: ${Python_NumPy_INCLUDE_DIRS}") # execute_process(COMMAND ${Python_EXECUTABLE} -c "import numpy;print(numpy.get_include())" OUTPUT_VARIABLE Python_NumPy_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) # execute_process(COMMAND which python3 OUTPUT_VARIABLE Python_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE) # execute_process(COMMAND ${Python_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_paths()['include'])" OUTPUT_VARIABLE Python_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) # execute_process(COMMAND ${Python_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))" OUTPUT_VARIABLE Python_LIBRARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) # set(Python_LIBRARY "${Python_LIBRARY_DIR}/libpython3.10.so") # include_directories(/usr/include/python3.10) ... target_link_libraries(mynode ${OpenCV_LIBS} ${cpp_typesupport_target} ${ONNX_LIBS} ${TORCH_LIBS} ${Python_LIBRARIES} common_tool_lib ) target_include_directories(mynode PRIVATE /usr/local/onnxruntime/include /usr/local/libtorch/include /usr/local/libtorch/include/torch/csrc/api/include ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS} ) I've tried various methods and even asked several AI tools but still cannot solve this, and it seems I have to give up calling python codes from my C++ environment. Any ideas? Continue reading...