mapillary / OpenSfM

Open source Structure-from-Motion pipeline
https://www.opensfm.org/
BSD 2-Clause "Simplified" License
3.35k stars 853 forks source link

CMake error in setup.py #270

Open Jekyll1021 opened 6 years ago

Jekyll1021 commented 6 years ago

setup.py gives me a "NumPy import failure" despite I have numpy installed and successfully imported in python 2.7.

The full error log is attached as following

Configuring... -- A library with BLAS API found. -- A library with LAPACK API found. -- A library with BLAS API found. -- Found AMD library: /usr/lib/aarch64-linux-gnu/libamd.so -- Found AMD header in: /usr/include/suitesparse -- Found CAMD library: /usr/lib/aarch64-linux-gnu/libcamd.so -- Found CAMD header in: /usr/include/suitesparse -- Found COLAMD library: /usr/lib/aarch64-linux-gnu/libcolamd.so -- Found COLAMD header in: /usr/include/suitesparse -- Found CCOLAMD library: /usr/lib/aarch64-linux-gnu/libccolamd.so -- Found CCOLAMD header in: /usr/include/suitesparse -- Found CHOLMOD library: /usr/lib/aarch64-linux-gnu/libcholmod.so -- Found CHOLMOD header in: /usr/include/suitesparse -- Found CXSPARSE library: /usr/lib/aarch64-linux-gnu/libcxsparse.so -- Found SuiteSparseQR library: /usr/lib/aarch64-linux-gnu/libspqr.so -- Found SuiteSparseQR header in: /usr/include/suitesparse -- Found Intel Thread Building Blocks (TBB) library: /usr/lib/aarch64-linux-gnu/libtbb.so, assuming SuiteSparseQR was compiled with TBB. -- Found Intel Thread Building Blocks (TBB) Malloc library: /usr/lib/aarch64-linux-gnu/libtbbmalloc.so -- Found SuiteSparse_config library: /usr/lib/aarch64-linux-gnu/libsuitesparseconfig.so -- Found SuiteSparse_config header in: /usr/include/suitesparse -- Adding librt: /usr/lib/aarch64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing). -- Did not find METIS library (optional SuiteSparse dependency) -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available. -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake. -- Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components. -- Boost version: 1.58.0 -- Found the following Boost libraries: -- python Not using boost/python/numpy. CMake Error at cmake/FindNumPy.cmake:62 (message): NumPy import failure:

Call Stack (most recent call first): CMakeLists.txt:66 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/dongzisu/source/OpenSfM/cmake_build/CMakeFiles/CMakeOutput.log". Compiling extension... -- A library with BLAS API found. -- A library with LAPACK API found. -- A library with BLAS API found. -- Found AMD library: /usr/lib/aarch64-linux-gnu/libamd.so -- Found AMD header in: /usr/include/suitesparse -- Found CAMD library: /usr/lib/aarch64-linux-gnu/libcamd.so -- Found CAMD header in: /usr/include/suitesparse -- Found COLAMD library: /usr/lib/aarch64-linux-gnu/libcolamd.so -- Found COLAMD header in: /usr/include/suitesparse -- Found CCOLAMD library: /usr/lib/aarch64-linux-gnu/libccolamd.so -- Found CCOLAMD header in: /usr/include/suitesparse -- Found CHOLMOD library: /usr/lib/aarch64-linux-gnu/libcholmod.so -- Found CHOLMOD header in: /usr/include/suitesparse -- Found CXSPARSE library: /usr/lib/aarch64-linux-gnu/libcxsparse.so -- Found SuiteSparseQR library: /usr/lib/aarch64-linux-gnu/libspqr.so -- Found SuiteSparseQR header in: /usr/include/suitesparse -- Found Intel Thread Building Blocks (TBB) library: /usr/lib/aarch64-linux-gnu/libtbb.so, assuming SuiteSparseQR was compiled with TBB. -- Found Intel Thread Building Blocks (TBB) Malloc library: /usr/lib/aarch64-linux-gnu/libtbbmalloc.so -- Found SuiteSparse_config library: /usr/lib/aarch64-linux-gnu/libsuitesparseconfig.so -- Found SuiteSparse_config header in: /usr/include/suitesparse -- Adding librt: /usr/lib/aarch64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing). -- Did not find METIS library (optional SuiteSparse dependency) -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available. -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake. -- Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components. -- Boost version: 1.58.0 -- Found the following Boost libraries: -- python Not using boost/python/numpy. CMake Error at cmake/FindNumPy.cmake:62 (message): NumPy import failure:

Call Stack (most recent call first): CMakeLists.txt:66 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/dongzisu/source/OpenSfM/cmake_build/CMakeFiles/CMakeOutput.log". Makefile:1518: recipe for target 'cmake_check_build_system' failed make: *** [cmake_check_build_system] Error 1 Building package running build running build_py running build_scripts

Could anyone give me hint on that?

paulinus commented 6 years ago

@Jekyll1021, I don't know what happened there but here are some sanity checks: make sure you are using python 2, and that python-dev and python-numpy ubuntu packages are installed.

Jekyll1021 commented 6 years ago

Hi Paulinus, I checked python-dev, python-numpy, cmake and libboost-python-dev, they are all in latest version. Now I'm getting confused by how I can make use of the commands in bin since they all import opensfm... @paulinus

paulinus commented 6 years ago

For some reason, cmake is not finding NumPy. If you have it installed, it might be that some PATH is not set properly. Are you using ubuntu 16.04? The commands here do work on a clean ubuntu 16.04.

b-atong commented 6 years ago

I have exactly the same issue on Ubuntu 16.04. Pretty sure everything else is installed correctly. Numpy can be imported from the interpreter. What should PATH/PYTHONPATH look like?

paulinus commented 6 years ago

Thanks for warning about it, @jordi102. May be you can help debugging this.

What is failing is the execution of this command during the cmake configuration.

If you are able to import numpy from the interpreter, it might mean that the interpreter you run is not the same as the one cmake uses, or that the PYTHONPATH is different.

Can you send here the results of these commands?

  1. Python interpreter path: which python
  2. Python path: echo $PYTHONPATH
  3. Python info in cake: grep -i python cmake_build/CMakeCache.txt

On your path question, when using the numpy installed via pip or apt, you should not need to set the PYTHONPATH to anything.