microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.85k stars 2.94k forks source link

Cannot open include file: numpy/arrayobject.h #16027

Open danny1222 opened 1 year ago

danny1222 commented 1 year ago

C:\onnxruntime\onnxruntime\python\onnxruntime_pybind_state.cc(10,10): fatal error C1083: Cannot open include file: numpy/arrayobject.h': No such file or directory

I meet the issue when compiling in windows, can you give any suggestion?

tianleiwu commented 1 year ago

pip install numpy

mszhanyi commented 1 year ago

Could you paste your build command?

tianleiwu commented 1 year ago

Could you paste your build command?

see https://github.com/microsoft/onnxruntime/pull/16012

An example to build with CUDA in Windows:

python tools\ci_build\build.py --config Release  --build_shared_lib  --cmake_generator "Visual Studio 16 2019" --use_cuda --cuda_version 11.8 --cuda_home "H:\CUDA_11.8" --cudnn_home "H:\CUDA_11.8" --build_wheel --skip_tests --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES=86 --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF --cmake_path "C:\Program Files\CMake\bin\cmake.exe" --parallel 3
jcoliz commented 11 months ago

@mszhanyi I am also getting this problem. Following https://onnxruntime.ai/docs/build/eps.html#qnn

This command:

./build.bat --arm64 --use_qnn  --qnn_home=C:\Qualcomm\AIStack\QNN\2.17.0.231124 --build_wheel --cmake_generator "Visual Studio 17 2022" --skip_submodule_sync --config Release --build_dir \build\Windows

Runs for 15+ minutes, then produces this result:

C:\Source\Microsoft\onnxruntime\onnxruntime\python\onnxruntime_pybind_mlvalue.cc(11,10): error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory [C:\build\Windows\Release\onnxruntime_pybind11_state.vcxproj]
C:\Source\Microsoft\onnxruntime\onnxruntime\python\onnxruntime_pybind_iobinding.cc(11,10): error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory [C:\build\Windows\Release\onnxruntime_pybind11_state.vcxproj]
C:\Source\Microsoft\onnxruntime\onnxruntime\python\onnxruntime_pybind_sparse_tensor.cc(11,10): error C1083: Cannot open  include file: 'numpy/arrayobject.h': No such file or directory [C:\build\Windows\Release\onnxruntime_pybind11_state.vcxproj]
C:\Source\Microsoft\onnxruntime\onnxruntime\python\onnxruntime_pybind_ortvalue.cc(11,10): error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory [C:\build\Windows\Release\onnxruntime_pybind11_state.vcxproj]
C:\Source\Microsoft\onnxruntime\onnxruntime\python\onnxruntime_pybind_state.cc(10,10): error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory [C:\build\Windows\Release\onnxruntime_pybind11_state.vcxproj]

numpy is installed:

PS C:\Source\Microsoft\onnxruntime> pip install numpy
Requirement already satisfied: numpy in c:\users\me\appdata\roaming\python\python311-arm64\site-packages (1.26.2)
1309896340 commented 2 months ago

The same issue as @jcoliz . I'm compiling a package on Windows. This package depends on "matplotlibcpp". When I compile it, a fatal error triggered off, said "numpy/arrayobject.h: No such file or directory". My python environment is installed by Anaconda. The header file is located on "Anaconda\Lib\site-packages\numpy\core\include\numpy\arrayobject.h".

How to configure it in CMakefiles.txt ?

ashumish-QCOM commented 1 month ago

Update CMake Configuration: If you are using CMake, make sure to include the NumPy include directory in your CMakeLists.txt file.