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

Error compiling im2mesh #2

Closed SilvioGiancola closed 5 years ago

SilvioGiancola commented 5 years ago

Hi, I am getting the following error while compiling im2mesh on Ubuntu 16.04:

(mesh_funcspace) giancos@PC-KW-60110:~/git/occupancy_networks$ python setup.py build_ext --inplace
running build_ext
building 'im2mesh.utils.libkdtree.pykdtree.kdtree' extension
gcc -pthread -B /home/giancos/anaconda3/envs/mesh_funcspace/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/giancos/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:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

Any advice?

LMescheder commented 5 years ago

Seems like you are missing numpy dependencies (also see here). Have you installed and activated the anaconda environment as described in the readme?

SilvioGiancola commented 5 years ago

Thanks for your support, I solved my problem with sudo apt-get install python-numpy. Impressive demo!

rmichnovicz commented 4 years ago

Hey guys! Note for anyone else who comes across this problem and doesn't have sudo:

I ran python and got numpy's include directory as follows

>>>import numpy as np
>>>np.get_include()
/nethome/user/.../include

I then did export CFLAGS="-I/nethome/user/.../include $CFLAGS" And I was able to compile!

dsvilarkovic commented 4 years ago

One thing that could also be done is on line 106-111 change to include numpy include directory:

setup(
    ext_modules=cythonize(ext_modules),
    include_dirs=[numpy_include_dir],
    cmdclass={
        'build_ext': BuildExtension
    }
)

After that it works flawlessly

b7leung commented 4 years ago

A simple fix to generalize @rmichnovicz and @dsvilarkovic 's ideas:

setup(
    ext_modules=cythonize(ext_modules),
    include_dirs=[numpy.get_include()],
    cmdclass={
        'build_ext': BuildExtension
    }
)
jiandandian2 commented 4 years ago

One thing that could also be done is on line 106-111 change to include numpy include directory:

setup(
    ext_modules=cythonize(ext_modules),
    include_dirs=[numpy_include_dir],
    cmdclass={
        'build_ext': BuildExtension
    }
)

After that it works flawlessly

where exactly to add?

dsvilarkovic commented 4 years ago

One thing that could also be done is on line 106-111 change to include numpy include directory:

setup(
    ext_modules=cythonize(ext_modules),
    include_dirs=[numpy_include_dir],
    cmdclass={
        'build_ext': BuildExtension
    }
)

After that it works flawlessly

where exactly to add?

In setup.py replace lines 106-111 to the thing I wrote