Search code examples
opencvtensorflowvirtualenvubuntu-16.04virtualenvwrapper

how to combine Opencv module (virtualenvwrapper) and Tensorflow module (another virtualenv)?


Following several instructions on the web, I could install Opencv3.0 and tensorflow on my Ubuntu 16.04. Each tutorial recommends using virtual environment. Although I agree that, problem is that I just followed the tutorials and created separate environments.

** For minor information, Tensorflow installation was easy, but Opencv3.0 was hard.

I used virtualenv for Tensorflow with the name tf, and virtualenvwrapper for Opencv with the name cv, i.e., I activate tf by $ source ~/project/tf/bin/activate, and cv by $ workon cv.

In this case, what is the best way of using both? Should I activate both always? Should I enter one environment and install the other again? Should I symlink site-package/cv.so to tf environment?

I think cv is now in the python site-package folder. I create tf with --site-package option, but it was before installing cv. I am so confusing. Please help.


Solution

  • Yes, I had the same issue and the sym-link between tensorflow and openCV will not work after making the cv.so inside the tf virtualenv after some struggle I got them both to work in the same environment but I suggest uninstalling openCV and then install it back without using a virtual environment for better results.

    Cheers.