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

Unable to run examples on windows 10 with anaconda/pip install #2423

Closed
KristofferBerge opened this Issue Sep 27, 2017 · 15 comments

Comments

Projects
None yet
10 participants
@KristofferBerge

KristofferBerge commented Sep 27, 2017

I have tried both the script setup and pip install methods a couple of times now, but still not able to run the demos.

In the demo Examples/Image/Detection I am not able to run the command python DetectionDemo.py. This is the output:

training FasterRCNN
Traceback (most recent call last):
File ".\DetectionDemo.py", line 59, in
eval_model = od.train_object_detector(cfg)
File "C:\cntk-2-2\CNTK-Samples-2-2\Examples\Image\Detection\utils\od_utils.py", line 19, in train_object_detector
from FasterRCNN.FasterRCNN_train import prepare, train_faster_rcnn
File "C:\cntk-2-2\CNTK-Samples-2-2\Examples\Image\Detection\FasterRCNN\FasterRCNN_train.py", line 30, in
from utils.od_mb_source import ObjectDetectionMinibatchSource
File "C:\cntk-2-2\CNTK-Samples-2-2\Examples\Image\Detection\utils\od_mb_source.py", line 9, in
from utils.od_reader import ObjectDetectionReader
File "C:\cntk-2-2\CNTK-Samples-2-2\Examples\Image\Detection\utils\od_reader.py", line 8, in
import cv2 # pip install opencv-python
File "C:\Users\krberge\AppData\Local\Continuum\Anaconda3\lib\site-packages\cv2_init_.py", line 9, in
from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.
PS C:\cntk-2-2\CNTK-Samples-2-2\Examples\Image\Detection>

From what I understand, this boils down to the cv2 import, because the command python -c "import cv2" outputs a similar error message

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\krberge\AppData\Local\Continuum\Anaconda3\lib\site-packages\cv2_init_.py", line 9, in
from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.

Runnin pip install opencv-python outputs that everything is up to date.

Not really sure what is missing here and how python/anaconda does imports.

I also noticed that the example I'm trying to run is using Fast R-CNN, so I followed the steps in the readme there too, but pip install dlib failes here. It says cmake is missing. After installing cmake with conda install cmake I get a new error saying that the cmake configuration failed.

I think the tutorial/install guide might be inadequate here, because I'm not able get anything to work by following the guide.

@kyoro1

This comment has been minimized.

Contributor

kyoro1 commented Sep 27, 2017

How about trying the following sites regarding import cv2?
https://stackoverflow.com/questions/33200025/cant-import-cv2-dll-load-failed
or
skvark/opencv-python#36

The situation is similar to yours.

@KristofferBerge

This comment has been minimized.

KristofferBerge commented Sep 28, 2017

There are a lot of suggestions on how to solve this, but this was actually very easy to solve when using Anaconda. The problem is not the Visual C++ 2015 redistribution, but rather the python3.dll which is missing from
C:\Users\username\AppData\Local\Continuum\Anaconda3 as your second link suggests.

A lot of these sites and answers on stack overflow suggests downloading it manually, but according to this thread ContinuumIO/anaconda-issues#1394 the most recent anaconda packages should all include the missing python3.dll file. So by updating python with conda, this was solved:

conda update python

Should the installation guide be changed to a more recent version of the anaconda3 package that includes the missing dll? https://docs.microsoft.com/en-us/cognitive-toolkit/setup-windows-python?tabs=cntkpy22

@kyoro1

This comment has been minimized.

Contributor

kyoro1 commented Sep 28, 2017

If you want to install of dlib, the following command may be useful:

conda install -c menpo dlib=18.18

I found a description regarding this command, but it's written in Japanese(my native language), and I've not found similar description in English as far as I checked..

@sn2234

This comment has been minimized.

sn2234 commented Oct 4, 2017

It looks like installing CNTK breaks Anaconda in some way. Here is steps to reproduce it:

@MarekOzana

This comment has been minimized.

MarekOzana commented Oct 8, 2017

I have exactly the same issue. CNTK breaks the latest Anaconda 5.0.0 on windows 10 x64.
First I noticed the ImportError in matplotlib.pyplot after update of existing conda installation to the latest version. The clean reinstall didn't helped. Import error re-appears immediately after CNTK install.
For me it is a show stopper, please suggest a workaround.

@sn2234

This comment has been minimized.

sn2234 commented Oct 8, 2017

Here are my findings:
CNTK installs an additional copy of zlib.dll into \zlib.dll
The original copy is located in \Library\bin\zlib.dll
The CNTK's version is outdated
The conda start script places \ before \Library\bin
So wrong version of the library is loaded
I've tried to replace zlib in root by newer version. This way matplotlib is partially functional, although I've found issues with pyplot.imsave

@felagund08

This comment has been minimized.

felagund08 commented Oct 22, 2017

I have the same issue on Windows 7: CNTK breaks the Anaconda 5.0.0 release on Windows 7 x64 SP1 with the same error when importing matplotlib. Had anyone figured out the solution yet?

@sn2234

This comment has been minimized.

sn2234 commented Oct 22, 2017

The workaround, that works for me as far as I was able to test is to move zlib.dll from Library\Bin to anaconda root, overriding the one that installed by CNTK. The CNTK looks pretty fine with the newer version of zlib.

@felagund08

This comment has been minimized.

felagund08 commented Oct 23, 2017

Thanks, but as you said, there are still some problems with matplotlib modules, so it looks like a partial solution.

@sn2234

This comment has been minimized.

sn2234 commented Oct 23, 2017

That was actually an issue in anaconda packages, right now it works fine.

@rfernand2

This comment has been minimized.

rfernand2 commented Oct 27, 2017

Just ran into the same problem today (10/26/2017) with CNTK 2.2, Anaconda3 5.0.1 (64-bit), and having problems withn matplotlib. Still not fixed.

@rfernand2

This comment has been minimized.

rfernand2 commented Oct 27, 2017

Update: just uninstalled latest Anaconda3 (windows, 64-bit) and installed it again (without CNTK this time). Confirmed that the matplotlib problem exists just in the Anaconda install. Uninstalled & installed Anaconda 4.4.0 (windows, 64-bit). Matplotlib works fine now. Installed CNTK 2.2 on top of this, matplotlib still works fine.

@sn2234

This comment has been minimized.

sn2234 commented Oct 27, 2017

It should be.
The problem with matplotlib was caused by a separate issue (ContinuumIO/anaconda-issues#6535), it's not actually related to CNTK.

@HectorSVC HectorSVC closed this Oct 27, 2017

@kpierce8

This comment has been minimized.

kpierce8 commented Nov 9, 2017

I also had the .cv2 error. The https://github.com/Azure/ObjectDetectionUsingCntk repo on github has an opencv whl at the following location. Pip installing that solved my cv2 problem.

ObjectDetectionUsingCntk\resources\python35_64bit_requirements\opencv_python-3.2.0-cp35-cp35m-win_amd64.whl"

@zie-1

This comment has been minimized.

zie-1 commented May 10, 2018

HI.
I am having trouble importing cv2. I get this error:( And I tried tutorials how to get rid of this but it wont just go away:( . Any help? or suggestion? Thankyou:)

import cv2
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Lenovo\Anaconda3\envs\opencv-env\lib\site-packages\cv2_init_.py", line 4, in
from .cv2 import *
ImportError: Module use of python27.dll conflicts with this version of Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment