occupancy_networks icon indicating copy to clipboard operation
occupancy_networks copied to clipboard

No module named 'im2mesh.utils.libkdtree.pykdtree.kdtree'

Open MASTERCHIEF343 opened this issue 5 years ago • 8 comments

Hi, I have some problems with code's configuration.I google it but not found a proper solution.I also follow 'conda env create -f environment.yaml ', but there's something wrong with my network that i can't download.Do you know how to fix this?

MASTERCHIEF343 avatar Jun 03 '19 13:06 MASTERCHIEF343

Hi @MASTERCHIEF343 , could you please provide more details to reproduce your problem? What did you try to achieve? What is the error message? ...

LMescheder avatar Jun 03 '19 14:06 LMescheder

(mesh_funcspace) D:\TF_GPU\occupancy_networks-master>python generate.py configs/demo.yaml Traceback (most recent call last): File "generate.py", line 10, in from im2mesh import config File "D:\TF_GPU\occupancy_networks-master\im2mesh\config.py", line 4, in from im2mesh import onet, r2n2, psgn, pix2mesh, dmc File "D:\TF_GPU\occupancy_networks-master\im2mesh\onet_init_.py", line 1, in from im2mesh.onet import ( File "D:\TF_GPU\occupancy_networks-master\im2mesh\onet\config.py", line 5, in from im2mesh.encoder import encoder_dict File "D:\TF_GPU\occupancy_networks-master\im2mesh\encoder_init_.py", line 1, in from im2mesh.encoder import ( File "D:\TF_GPU\occupancy_networks-master\im2mesh\encoder\conv.py", line 4, in from im2mesh.common import normalize_imagenet File "D:\TF_GPU\occupancy_networks-master\im2mesh\common.py", line 3, in from im2mesh.utils.libkdtree import KDTree File "D:\TF_GPU\occupancy_networks-master\im2mesh\utils\libkdtree_init_.py", line 1, in from .pykdtree.kdtree import KDTree ModuleNotFoundError: No module named 'im2mesh.utils.libkdtree.pykdtree.kdtree'

Sorry, i didn't make myself clear.This is my error,i don't know how to fix it.

MASTERCHIEF343 avatar Jun 03 '19 22:06 MASTERCHIEF343

Did anyone find the answer to this?

samunaai avatar Jun 04 '19 12:06 samunaai

pykdtree should be automatically built when running

python setup.py build_ext --inplace

Can you verify that the build step was successful?

LMescheder avatar Jun 04 '19 12:06 LMescheder

I am having a similar problem. After doing

python setup.py build_ext --inplace

i am seeing: running build_ext building 'im2mesh.utils.libkdtree.pykdtree.kdtree' extension gcc -pthread -B /home/mat/anaconda3/envs/mesh_funcspace/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/mat/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 #include "numpy/arrayobject.h" ^~~~~~~~~~~~~~~~~~~~~ compilation terminated. error: command 'gcc' failed with exit status 1

Here is how i fixed this: first you check in python where is your numpy: import numpy numpy.get_include()

and then before installing you do: export CFLAGS=-I/<path_to_include>

in my case it was: export CFLAGS=-I/home/jeremy/anaconda3/envs/mesh_funcspace/lib/python3.6/site-packages/numpy/core/include/

JeremyFisher avatar Aug 12 '19 04:08 JeremyFisher

Thanks to @JeremyFisher's fix, I get past the same error that he's having, but then I'm immediately met with another error:

gcc -pthread -B /home/chulabhaya/anaconda3/envs/mesh_funcspace/compiler_compat -Wl,--sysroot=/ -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/home/chulabhaya/anaconda3/lib/python3.7/site-packages/numpy/core/include -fPIC -I/home/chulabhaya/anaconda3/envs/mesh_funcspace/include/python3.6m -c im2mesh/utils/libkdtree/pykdtree/_kdtree_core.c -o build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/_kdtree_core.o -std=c99 -O3 -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=kdtree -D_GLIBCXX_USE_CXX11_ABI=0 gcc -pthread -shared -B /home/chulabhaya/anaconda3/envs/mesh_funcspace/compiler_compat -L/home/chulabhaya/anaconda3/envs/mesh_funcspace/lib -Wl,-rpath=/home/chulabhaya/anaconda3/envs/mesh_funcspace/lib -Wl,--no-as-needed -Wl,--sysroot=/ -I/home/chulabhaya/anaconda3/lib/python3.7/site-packages/numpy/core/include build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/_kdtree_core.o -o build/lib.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.cpython-36m-x86_64-linux-gnu.so -lgomp /home/chulabhaya/anaconda3/envs/mesh_funcspace/compiler_compat/ld: build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o: unable to initialize decompress status for section .debug_info /home/chulabhaya/anaconda3/envs/mesh_funcspace/compiler_compat/ld: build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o: unable to initialize decompress status for section .debug_info /home/chulabhaya/anaconda3/envs/mesh_funcspace/compiler_compat/ld: build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o: unable to initialize decompress status for section .debug_info /home/chulabhaya/anaconda3/envs/mesh_funcspace/compiler_compat/ld: build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o: unable to initialize decompress status for section .debug_info build/temp.linux-x86_64-3.6/im2mesh/utils/libkdtree/pykdtree/kdtree.o: file not recognized: file format not recognized collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1

Any ideas as to what might be causing this, and how to fix it? Thanks in advance!

SOLUTION: Found the solution to my issue, in case anyone runs into the same bug in the future. Turns out it's an Anaconda related issue, which is that Anaconda is using its own linker instead of the system's linker. I followed the fix mentioned here: https://github.com/pytorch/pytorch/issues/16683#issuecomment-459982988

Chulabhaya avatar Sep 20 '19 18:09 Chulabhaya

I managed to solve a similar problem simply by running:

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch

spha-code avatar Oct 10 '19 10:10 spha-code

I found a solution when I build this on windows platform. You can simply add include_dirs=[numpy_include_dir] to each module definition in the setup.py instead of calling anything from the command-line tool. Speaking of this, if I want to deploy this network on the Windows platform, does that means I need to change the libraries=['m'], # Unix-like specific into .lib?

Edwinzero avatar Nov 03 '19 17:11 Edwinzero