Ask Your Question
0

build INSTALL does not add package WINDOWS

asked 2018-03-08 08:28:34 -0600

mfischer-gundlach gravatar image

Hey there,

I want to build OpenCV from source on Windows and use the python bindings. My machine runs Windows 10, 64bit and have Anaconda installed with Python 3.6.4.

I followed the official manual found here: https://docs.opencv.org/3.0-beta/doc/... .

In general everything went smoothly until reaching step 17. When building INSTALL I can observed that cv2.cp36-win_amd64.pyd is moved to \Anaconda3\Lib\site-packages which is on my path for packages.

However, when I promt imput cv2 I am awarded with ImportError: DLL load failed: The specified module could not be found.. In keeping with this, pip list I also does not encloses opencv-python.

Could someone help me making my python aware of the opencv package. Thank you!

Additional Information

Earlier, I used binaries which where installed as wheels with pip install. I found the wheels on the unofficial page https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv. Doing so, additionally adds the file cv.py plus pip list shows the entry opencv-python.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2019-01-30 08:10:42 -0600

mfischer-gundlach gravatar image

updated 2019-01-30 08:18:06 -0600

I found a more compact solution, very close to this guide. It's more cumbersome, but leaves you with a very clean installation.

Introduction

This entry documents the installation of OpenCV from source for both C++ and Python. We will show the procedure at the hand of OpenCV 3.4.1, but all versions will work in the same or highly similar way. Since, at the time of writing, Visual Studio 2013 is the default IDE we cannot support OpenCV versions 4, as the C++ 11 standard is not supported by the VC 2013 compiler. Furthermore, we ran into similar problems for versions >= 3.4.2 We will, however, also include a section at the bottom which extends this guide to the installation of OpenCV 4 with Visual Studio 2017.

We will run most action from the command line. Our preferred tool for this is Window's native PowerShell.

Software Requirements

Visual Studio 2013

As explained above, Visual Studio 2013 with its C++ compiler, is the default IDE at the time of writing. You could also compile with a newer version of Visual Studio. However, it is not guaranteed that you can use the compiled code from applications compiled with a different Visual Studio version (and thus different compiler).

Git

We will use git to fetch the source code. You could also run this guide without git but downloading the source code from OpenCV's Github ... could but rather simply use git.

CMake

Download and install the most current version of CMake. We run this tutorial with version 3.11.0. Check the box Add CMake to the system path for current user.

Python (Anaconda Distribution)

We will also compile the Python bindings. Please install Anaconda as shown here. Although we will set-up and environment for our Python installation, we need to make sure we have the correct Python version (3.6) installed in the root environment. Therefore, install Anaconda and follow the instructions on the bottom of the installation guide and set the python installation to 3.6.

Now, open an Anaconda command prompt and create a new environment with name OpenCV and install Python 3.6 and all packages coming with Anaconda (for example numpy). You can do so, by pasting conda create -y -f -n OpenCV python=3.6 anaconda into the command prompt.

Remarks on Environment: We encountered problems when the python version in the root environment did not match the version in the OpenCV environment and therefore we needed to make sure we install the correct Python version in both environments. We do think it happens as CMake finds the root environment and does not ask us for its location. We found the workaround shown above. However, if you need a different Python version in your root, we think you can run this guide and use CMake for configuration BUT before generating the build, you need to open the CMakeCache.txt file in the build folder and change the Python library and interpreter paths ... (more)

edit flag offensive delete link more
0

answered 2018-11-29 01:28:51 -0600

zen gravatar image

I found solution. Copy opencv DLL near pyd and other dlls which requires for your pyd from your build it is important.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-03-08 08:28:34 -0600

Seen: 1,034 times

Last updated: Jan 30 '19