1

I am trying to develop a system that requires OpenCV and dlib to be installed in anaconda to work with. I tried a lot to install dlib package in latest anaconda (Anaconda3-2019.03-Windows-x86_64) distribution. But it says to downgrade the python version. Again I also found the dlib package does not still support python3.7. See here the available versions:

https://pypi.org/simple/dlib/

Than I created a virtual environment having python3.6. But I faced another type of error. It cannot play video file (mp4). But it works fine if the video is taken from webcam. It shows the following error:

gray=cv.cvtColor(frame,cv.COLOR_BGR2GRAY) error: ..\..\..\modules\imgproc\src\color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor

As I found this error occurs when it doesn't find any video file. But in my case there is no reason of not finding a video file. I tried both by using video file name (keeping it in the same folder) and full path as well. It behaves the same.

Than I installed Anaconda3 (5.0.1) which comes with python3.6 which should work fine but I failed to install OpenCV using command:

conda install -c conda-forge OpenCV

It says:

CondaError: Cannot link a source that does not exist. C:\Users\Username\Anaconda3\Scripts\conda.exeRunning `conda clean --packages` may resolve your problem.

It throws the same error even if I try to install OpenCV after cleaning conda packeges.

With which versions of these navigator, python, OpenCV and dlib I can make a stable working environment for my work and how?

Summarizing what I want:

  1. A stable anaconda installation
  2. Can work with dlib and OpenCV libraries
  3. No problem in working with video files. No matter it comes from webcam or other saved video.

Please help me :(

hafiz031
  • 2,236
  • 3
  • 26
  • 48

1 Answers1

3

Well I solved this problem myself. These are what I did:

  1. Removing existing Anaconda distribution "Completely". Follow instructions from here:

    https://docs.anaconda.com/anaconda/install/uninstall/
    
  2. Installing Anaconda3 5.2.0 from here (this version comes with python 3.6.5 that satisfies the requirements):

    https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe
    
  3. Installing OpenCV from Anaconda prompt. See here:

    https://anaconda.org/conda-forge/opencv
    
  4. Installing dlib (19.7.0) from Anaconda prompt using this command:

    pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
    

Done!

NB:

Here I got some of the steps from the following posts:

For uninstalling Anaconda I found the solution from: How to remove anaconda from windows completely? | Answered by: Jakob

For installing dlib I found the solution from: dlib installation on Windows 10 | Answered by: Marco D.G.

I am thankful to them as well.

hafiz031
  • 2,236
  • 3
  • 26
  • 48