Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when installing yolo34py-gpu from source. #137

Open
justin-kel opened this issue Jul 7, 2021 · 2 comments
Open

Error when installing yolo34py-gpu from source. #137

justin-kel opened this issue Jul 7, 2021 · 2 comments

Comments

@justin-kel
Copy link

justin-kel commented Jul 7, 2021

python 3.6.9
ubuntu 18.04
opencv version 4.5.2

nvcc --version returns:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_21:14:42_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89

When running pip install . in /src,with OPENCV=1 and GPU=1:

Defaulting to user installation because normal site-packages is not writeable
Processing /home/justin/YOLO3-4-Py/src
  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
Requirement already satisfied: cython>=0.27 in /home/justin/.local/lib/python3.6/site-packages (from yolo34py-gpu==0.2) (0.29.23)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from yolo34py-gpu==0.2) (2.18.4)
Requirement already satisfied: numpy in /home/justin/.local/lib/python3.6/site-packages (from yolo34py-gpu==0.2) (1.19.5)
Building wheels for collected packages: yolo34py-gpu
  Building wheel for yolo34py-gpu (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-8r9ev6tn/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-8r9ev6tn/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-mze17mui
       cwd: /tmp/pip-req-build-8r9ev6tn/
  Complete output (26 lines):
  INFO:root:Compiling wrapper with gpu
  INFO:root:Compiling wrapper with OpenCV
  INFO:root:Darknet will be downloaded from 'https://github.com/madhawav/darknet/archive/yolo34py-intergration-v2.zip'
  running bdist_wheel
  running build
  /usr/lib/python3/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version!
    RequestsDependencyWarning)
  INFO:root:Temp Path: /tmp/darknet
  INFO:root:Downloading darknet
  INFO:root:Extracting darknet
  INFO:root:Building darknet
  INFO:root:b'gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU -c ./src/gemm.c -o obj/gemm.o'
  In file included from /usr/include/opencv/opencv2/core/types_c.h:82:0,
                   from /usr/include/opencv/opencv2/core/core_c.h:48,
                   from /usr/include/opencv/opencv2/highgui/highgui_c.h:45,
                   from include/darknet.h:25,
                   from ./src/utils.h:5,
                   from ./src/gemm.c:2:
  /usr/include/opencv/opencv2/core/cvdef.h:690:4: error: #error "OpenCV 4.x+ requires enabled C++11 support"
   #  error "OpenCV 4.x+ requires enabled C++11 support"
      ^~~~~
  compilation terminated due to -Wfatal-errors.
  make: *** [obj/gemm.o] Error 1
  INFO:root:b"Makefile:85: recipe for target 'obj/gemm.o' failed"
  INFO:root:Moving to /tmp/pip-req-build-8r9ev6tn/__libdarknet/libdarknet.so
  error: [Errno 2] No such file or directory: '/tmp/darknet/darknet-yolo34py-intergration-v2/libdarknet.so'
  ----------------------------------------
  ERROR: Failed building wheel for yolo34py-gpu
  Running setup.py clean for yolo34py-gpu
Failed to build yolo34py-gpu
Installing collected packages: yolo34py-gpu
  Attempting uninstall: yolo34py-gpu
    Found existing installation: yolo34py-gpu 0.2
    Uninstalling yolo34py-gpu-0.2:
      Successfully uninstalled yolo34py-gpu-0.2
    Running setup.py install for yolo34py-gpu ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-8r9ev6tn/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-8r9ev6tn/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-l6dttaf9/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/justin/.local/include/python3.6m/yolo34py-gpu
         cwd: /tmp/pip-req-build-8r9ev6tn/
    Complete output (26 lines):
    INFO:root:Compiling wrapper with gpu
    INFO:root:Compiling wrapper with OpenCV
    INFO:root:Darknet will be downloaded from 'https://github.com/madhawav/darknet/archive/yolo34py-intergration-v2.zip'
    running install
    running build
    /usr/lib/python3/dist-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.26.6) or chardet (3.0.4) doesn't match a supported version!
      RequestsDependencyWarning)
    INFO:root:Temp Path: /tmp/darknet
    INFO:root:Downloading darknet
    INFO:root:Extracting darknet
    INFO:root:Building darknet
    INFO:root:b'gcc -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU -c ./src/gemm.c -o obj/gemm.o'
    In file included from /usr/include/opencv/opencv2/core/types_c.h:82:0,
                     from /usr/include/opencv/opencv2/core/core_c.h:48,
                     from /usr/include/opencv/opencv2/highgui/highgui_c.h:45,
                     from include/darknet.h:25,
                     from ./src/utils.h:5,
                     from ./src/gemm.c:2:
    /usr/include/opencv/opencv2/core/cvdef.h:690:4: error: #error "OpenCV 4.x+ requires enabled C++11 support"
     #  error "OpenCV 4.x+ requires enabled C++11 support"
        ^~~~~
    compilation terminated due to -Wfatal-errors.
    make: *** [obj/gemm.o] Error 1
    INFO:root:b"Makefile:85: recipe for target 'obj/gemm.o' failed"
    INFO:root:Moving to /tmp/pip-req-build-8r9ev6tn/__libdarknet/libdarknet.so
    error: [Errno 2] No such file or directory: '/tmp/darknet/darknet-yolo34py-intergration-v2/libdarknet.so'
    ----------------------------------------
  Rolling back uninstall of yolo34py-gpu
  Moving to /home/justin/.local/lib/python3.6/site-packages/__libdarknet/
   from /home/justin/.local/lib/python3.6/site-packages/~_libdarknet
  Moving to /home/justin/.local/lib/python3.6/site-packages/pydarknet.cpython-36m-aarch64-linux-gnu.so
   from /tmp/pip-uninstall-n9181p4p/pydarknet.cpython-36m-aarch64-linux-gnu.so
  Moving to /home/justin/.local/lib/python3.6/site-packages/yolo34py_gpu-0.2.dist-info/
   from /home/justin/.local/lib/python3.6/site-packages/~olo34py_gpu-0.2.dist-info
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-8r9ev6tn/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-8r9ev6tn/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-l6dttaf9/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/justin/.local/include/python3.6m/yolo34py-gpu Check the logs for full command output.

@madhawav
Copy link
Owner

Hi,

This is because OpenCV requries -std=c++11 compiler flag. To fix, try the following:

At the line 33 of setup.py file, add the following two lines:

extra_compile_args += ["-std=c++11"]
extra_link_args += ["-std=c++11"]

Let me know if this works.

@cedricve
Copy link

cedricve commented Sep 5, 2021

hey @madhawav similar error.

#31 2.855 /usr/lib/python3/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#31 2.855 #warning "Using deprecated NumPy API, disable it by "
#31 2.855 ^
#31 2.855 pydarknet.cpp: In function 'int pyx_pf_9pydarknet_5Image___cinit(__pyx_obj_9pydarknet_Image*, PyArrayObject*)':
#31 2.855 pydarknet.cpp:2307:3: error: 'Mat' was not declared in this scope
#31 2.855 Mat __pyx_v_m;
#31 2.855 ^
#31 2.855 pydarknet.cpp:2307:3: note: suggested alternative:
#31 2.855 In file included from /usr/local/include/opencv2/core.hpp:59:0,
#31 2.855 from /usr/local/include/opencv2/opencv.hpp:52,
#31 2.855 from bridge.h:59,
#31 2.855 from pydarknet.cpp:640:
#31 2.855 /usr/local/include/opencv2/core/mat.hpp:779:18: note: 'cv::Mat'
#31 2.855 class CV_EXPORTS Mat
#31 2.855 ^
#31 2.855 pydarknet.cpp:2433:3: error: '__pyx_v_m' was not declared in this scope
#31 2.855 __pyx_v_m.create(__pyx_v_r, __pyx_v_c, CV_8UC3);
#31 2.855 ^
#31 2.855 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
#31 2.855
#31 2.855 ------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants