fehlfarbe / python-aruco

Python wrappers for ArUco library
Other
67 stars 16 forks source link

numpy/arrayobject.h error #37

Closed b4zz4 closed 4 years ago

b4zz4 commented 4 years ago
 ./python3.7m -m pip install aruco --user
Collecting aruco
  Using cached https://files.pythonhosted.org/packages/ab/e0/ed8d9d366a9816ba34908ca91d88149a7b3dcc61f91c76850269639965a0/aruco-3.1.2.0.tar.gz
Requirement already satisfied: numpy in /home/user/.local/lib/python3.7/site-packages (from aruco) (1.17.4)
Requirement already satisfied: opencv-contrib-python in /home/user/.local/lib/python3.7/site-packages (from aruco) (4.1.2.30)
Installing collected packages: aruco
    Running setup.py install for aruco ... error
    ERROR: Command errored out with exit status 1:
     command: /home/user/src/blender-2.81-linux-glibc217-x86_64/2.81/python/bin/python3.7m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cxyyakvl/aruco/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cxyyakvl/aruco/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-yhtdq3m3/install-record.txt --single-version-externally-managed --compile --user --prefix=
         cwd: /tmp/pip-install-cxyyakvl/aruco/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    copying aruco.py -> build/lib.linux-x86_64-3.7
    running build_ext
    building '_aruco' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/src
    creating build/temp.linux-x86_64-3.7/src/aruco
    creating build/temp.linux-x86_64-3.7/src/aruco/fractallabelers
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/home/sergey/Developer/build_linux/deps/Release/sqlite/include -I/home/sergey/Developer/build_linux/deps/Release/bzip2/include -I/home/sergey/Developer/build_linux/deps/Release/lzma/include -I/home/sergey/Developer/build_linux/deps/Release/zlib/include -fPIC -fPIC -I/usr/local/include/opencv4/ -I/usr/local/include/opencv2 -I/usr/include/eigen3/ -Isrc/ -I/home/user/src/blender-2.81-linux-glibc217-x86_64/2.81/python/include/python3.7m -c aruco_wrap.cxx -o build/temp.linux-x86_64-3.7/aruco_wrap.o -std=c++11 -Wall -O3 -g0 -DNDEBUG -fopenmp
    aruco_wrap.cxx:5481:31: fatal error: numpy/arrayobject.h: No existe el archivo o el directorio
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/user/src/blender-2.81-linux-glibc217-x86_64/2.81/python/bin/python3.7m -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-cxyyakvl/aruco/setup.py'"'"'; __file__='"'"'/tmp/pip-install-cxyyakvl/aruco/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-yhtdq3m3/install-record.txt --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.
jokokojote commented 4 years ago

@b4zz4 I suppose you are on Mac OS? Just in case the problem is still relevant to you i share my workaround here.

I ran into the same problem and solved it thanks to this link: http://notesbyanerd.com/2018/11/02/pip-install-cant-find-numpy-header/

In short: Add the directory where the numpy sources are located to CFLAGS environment variable. E.g. export CFLAGS="-I /Users/Salim/Library/Python/3.7/lib/python/site-packages/numpy/core/include $CFLAGS"

You can get the path easily using this:

import numpy as np
np.get_include()

PS: Just in case someone else experiences this behaivior: After that i had a similar error with eigen/core despite i installed it on my system using homebrew. The solution was quite the same. Add the directory where eigen was installed to CFLAGS, e.g.: export CFLAGS="-I /usr/local/include/eigen3 $CFLAGS"

booo commented 4 years ago

It seems quite wrong to set absolute paths here: https://github.com/fehlfarbe/python-aruco/blob/master/setup.py#L32

Build fails in a virtual env on archlinux too :/

byteofsoren commented 4 years ago

I have the same problem on archlinux too. Any one solved tihs??

byteofsoren commented 4 years ago

Got it working on Archlinux now #39. You need to add a symlink for opencv2 as mentioned on the updated README.md

fehlfarbe commented 4 years ago

Thanks! I merged the pull request.