Search code examples
opencvanacondadarknet

How to fix "fatal error: opencv2/core.hpp: No such file or directory" to build Darknet properly with conda virtual environment


I am using conda virtual environment on Ubuntu 20.04 and I got this error while using "make" in Darknet folder even if my virtual environment(conda) has Opencv installed.

Here is the screenshot of the error:

Here is the screenshot of the error

Here is that cv2 is working and its version(4.5.5):

Here is that cv2 is working and its version(4.5.5)

Here is the environment variables for CUDA and Opencv I used (in .bashrc):

Here is the environment variables for CUDA and Opencv I used (in .bashrc)

Thanks in advance for your any help!


Solution

  • It seems that the problem is originated from not building OpenCV as Darknet needs.

    As @ChristophRackwitz implied, showing python version worked is not enough to build darknet with OpenCV capability. To be able to build darknet with OpenCV ON, OpenCV should be built with C++ functionalities as some of instructions might be followed:

    Instruction 1

    Instruction 2 and so on.