Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy import issues with ClearMap.compile #126

Open
jemajet opened this issue Aug 2, 2023 · 1 comment
Open

Numpy import issues with ClearMap.compile #126

jemajet opened this issue Aug 2, 2023 · 1 comment

Comments

@jemajet
Copy link

jemajet commented Aug 2, 2023

Hi, I'm working on installing from source in a non-conda environment, and I was running into an issue with
running ClearMap.Compile with the TraceCode cythonization step. When cythonizing just that file, I ran into the error of

cythonize -i -a /transfer/ClearMap2/ClearMap/ImageProcessing/Tracing/TraceCode.pyx
running build_ext
building 'ClearMap.ImageProcessing.Tracing.TraceCode' extension
creating /transfer/ClearMap2/tmpbovrp7cy/transfer
creating /transfer/ClearMap2/tmpbovrp7cy//transfer/ClearMap2
creating /transfer/ClearMap2/tmpbovrp7cy/transfer/ClearMap2/ClearMap
creating /transfer/ClearMap2/tmpbovrp7cy/transfer/ClearMap2/ClearMap/ImageProcessing
creating /transfer/ClearMap2/tmpbovrp7cy/transfer/ClearMap2/ClearMap/ImageProcessing/Tracing
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/transfer/ClearMap2/ClearMap/ImageProcessing/Tracing -I/usr/local/include/python3.8 -c /transfer/ClearMap2/ClearMap/ImageProcessing/Tracing/TraceCode.cpp -o /transfer/ClearMap2/tmpbovrp7cy/transfer/ClearMap2/ClearMap/ImageProcessing/Tracing/TraceCode.o
/transfer/ClearMap2/ClearMap/ImageProcessing/Tracing/TraceCode.cpp:785:10: fatal error: numpy/arrayobject.h: No such file or directory
 #include "numpy/arrayobject.h"
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

I was able to work around this by installing from setup.py with the command python setup.py build_ext --inplace, since that script uses np.get_include() to find the numpy path. I'm not sure if this is an issue that needs to change with the installation documentation or within the Compile.py script, otherwise I'd make a pull request with a fix. Happy to help with the fix if needed, but wanted to bring this to your attention.

@crousseau
Copy link
Collaborator

@jemajet Indeed, in the future, I'd rather go with the setup script (or the more recent alternative when I get the time to) than using the compile script or compiling by hand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants