autonomousvision / occupancy_networks

This repository contains the code for the paper "Occupancy Networks - Learning 3D Reconstruction in Function Space"
https://avg.is.tuebingen.mpg.de/publications/occupancy-networks
MIT License
1.5k stars 292 forks source link

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

Open MASTERCHIEF343 opened 5 years ago

MASTERCHIEF343 commented 5 years ago

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?

LMescheder commented 5 years ago

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

MASTERCHIEF343 commented 5 years ago

(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.

samunaai commented 5 years ago

Did anyone find the answer to this?

LMescheder commented 5 years ago

pykdtree should be automatically built when running

python setup.py build_ext --inplace

Can you verify that the build step was successful?

JeremyFisher commented 5 years ago

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/

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

Chulabhaya commented 4 years ago

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

spha-code commented 4 years ago

I managed to solve a similar problem simply by running:

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch

Edwinzero commented 4 years ago

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?