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

undefined symbol: cblas_sgemm_alloc #114

Open
zergrisk1 opened this issue Aug 1, 2022 · 9 comments
Open

undefined symbol: cblas_sgemm_alloc #114

zergrisk1 opened this issue Aug 1, 2022 · 9 comments

Comments

@zergrisk1
Copy link

When I tried python setup.py build_ext --inplace,It fails with the error:
Traceback (most recent call last): File "setup.py", line 7, in <module> from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension File "/home/baichenghuan/anaconda3/envs/mesh_funcspace/lib/python3.6/site-packages/torch/__init__.py", line 84, in <module> from torch._C import * ImportError: /home/baichenghuan/anaconda3/envs/mesh_funcspace/lib/python3.6/site-packages/torch/lib/libmkldnn.so.0: undefined symbol: cblas_sgemm_alloc
How to solve it?

@zergrisk1
Copy link
Author

zergrisk1 commented Aug 1, 2022

I also triedconda install mkl -c anaconda and conda update -n base -c defaults conda but didn't work.

@jiyoonshincml
Copy link

I had the same problem, and solved it by installing torch 1.0.1 !

@zergrisk1
Copy link
Author

Oh it finally works !Thanks a lot !

@Blessing92
Copy link

HI, I also add the same issue, but after installing torch 1.0.1, when I run python setup.py build_ext --inplace it throws this error. Currently I am unable to solve it

building 'im2mesh.utils.libkdtree.pykdtree.kdtree' extension
gcc -pthread -B /home/alphaar/anaconda3/envs/mesh_funcspace/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/alphaar/anaconda3/envs/mesh_funcspace/include/python3.6m -c im2mesh/utils/libkdtree/pykdtree/kdtree.c -o build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o -std=c99 -O3 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=kdtree -D_GLIBCXX_USE_CXX11_ABI=0
im2mesh/utils/libkdtree/pykdtree/kdtree.c:525:10: fatal error: numpy/arrayobject.h: No such file or directory
525 | #include "numpy/arrayobject.h"
| ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1

@jiyoonshincml
Copy link

Try sudo apt-get install python-numpy

@aalibasic
Copy link

HI, I also add the same issue, but after installing torch 1.0.1, when I run python setup.py build_ext --inplace it throws this error. Currently I am unable to solve it

building 'im2mesh.utils.libkdtree.pykdtree.kdtree' extension gcc -pthread -B /home/alphaar/anaconda3/envs/mesh_funcspace/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/alphaar/anaconda3/envs/mesh_funcspace/include/python3.6m -c im2mesh/utils/libkdtree/pykdtree/kdtree.c -o build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o -std=c99 -O3 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=kdtree -D_GLIBCXX_USE_CXX11_ABI=0 im2mesh/utils/libkdtree/pykdtree/kdtree.c:525:10: fatal error: numpy/arrayobject.h: No such file or directory 525 | #include "numpy/arrayobject.h" | ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1

Did you figure this one out.

@Blessing92
Copy link

Thanks, @jiyoonshincml it worked with your suggestion!

@SMY19999
Copy link

another method is useful:
conda install mkl=2018 -c anaconda

@liubohan1998
Copy link

liubohan1998 commented Nov 2, 2022

HI, I also add the same issue, but after installing torch 1.0.1, when I run python setup.py build_ext --inplace it throws this error. Currently I am unable to solve it
building 'im2mesh.utils.libkdtree.pykdtree.kdtree' extension gcc -pthread -B /home/alphaar/anaconda3/envs/mesh_funcspace/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/alphaar/anaconda3/envs/mesh_funcspace/include/python3.6m -c im2mesh/utils/libkdtree/pykdtree/kdtree.c -o build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o -std=c99 -O3 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=kdtree -D_GLIBCXX_USE_CXX11_ABI=0 im2mesh/utils/libkdtree/pykdtree/kdtree.c:525:10: fatal error: numpy/arrayobject.h: No such file or directory 525 | #include "numpy/arrayobject.h" | ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1

Did you figure this one out.

I solved by following the top answer: https://stackoverflow.com/questions/14657375/cython-fatal-error-numpy-arrayobject-h-no-such-file-or-directory
there is a comment that:

Or, if you use cythonize() to make the ext_modules list,
include_dirs can be passed to setup()

follow that I add 'include_dirs' to setup, then it works

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

6 participants