I followed the following steps to replicate the Classical Music Composition Using State Space Models code.
The inference algorithms for this code are in Cython. To run the notebook, first run:
np.get_include()
, which will output a sample-path.
Then, in the terminal set export CFLAGS="-I sample-path $CFLAGS"
.
I used Windows equivalent:
set CFLAGS = "-IC:\\Users\\scvan\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\numpy\\core\\include%CFLAGS%"
Finally, in the terminal, run
python setup.py build_ext --inplace
However, when I try to run the build_ext command I keep getting the following error:
building 'BaumWelch' extension
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1264.0_x64__qbz5n2kfra8p0\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /TcBaumWelch.c /Fobuild\temp.win-amd64-cpython-310\Release\BaumWelch.obj
BaumWelch.c
BaumWelch.c(711): fatal error C1083: Cannot open include file: 'numpy/arrayobject.h': No such file or directory
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
To my knowledge, I have installed all the correct build tools in Visual Studio. Maybe I have used the wrong Windows equivalent for expor CFLAGS, can anybody help me out?
I fixed the problem by adding
include_dirs = [numpy.get_include()]
to thesetup.py
file: