Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install pyopencv inside virtualenv with --no-site-packages

I am trying to install pyopencv to virtualenv created with --no-site-packages option:

pip install pyopencv

But I am getting following error on Ubuntu 10.04.3:

CMake Error at CMakeLists.txt:186 (find_package):

Could not find a configuration file for package OpenCV.
Set OpenCV_DIR to the directory containing a CMake configuration file for

OpenCV.  The file will have one of the following names:
  OpenCVConfig.cmake
  opencv-config.cmake

I already installed numpy, scipy and OpenCV (libboost-dev libboost-python1.40.0 libboost-python1.40-dev cmake libcv4 libcv-dev libcvaux4 libcvaux-dev). Any ideas?

PS I know there is pre-built Ubuntu package python-opencv, but I don't know how to install it into virtualenv with --no-site-packages (probably symlink will work, but it is ugly...).

like image 776
Vladimir Mihailenco Avatar asked Dec 08 '11 17:12

Vladimir Mihailenco


People also ask

Do I need to install packages in virtual environment?

Installing virtualenv venv is included in the Python standard library and requires no additional installation. If you are using venv, you may skip this section. virtualenv is used to manage Python packages for different projects.

Should I install OpenCV in virtual environment?

We also learned which package to install and how to create a virtual environment for working on the package. For all purposes of learning computer vision using Python, we highly recommend installing opencv-contrib-python using prebuilt binaries.

Does virtualenv inherit packages?

If you build with virtualenv --system-site-packages ENV , your virtual environment will inherit packages from /usr/lib/python2. 7/site-packages (or wherever your global site-packages directory is).

Does virtualenv install pip?

With the default settings, venv will install both pip and setuptools. Using pip is the recommended way to install packages in Python, and setuptools is a dependency for pip . Because installing other packages is the most common use case for Python virtual environments, you'll want to have access to pip .


1 Answers

Adding this two lines to /etc/bash.bashrc (or just run in command prompt) fix problem.

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

Also follow insctuctions here: https://github.com/ingenuitas/SimpleCV#installation

like image 171
Nikolay Baluk Avatar answered Sep 30 '22 03:09

Nikolay Baluk