0

Rosanswers logo

I set up a virtualenvs for python 3.1 with opencv3. But when I am in the virtual env and execute python import cv2. Apparently you have to create a link of the 3.1.so file to cv2.so . I get an error relating to cv2 /opt/ros/kinetic . I do not know why it is looking here? If I uninstall ros then it works fine, no error. Any thoughts. Update: if I remove the .bashrc source kinetic setup then it also works fine in the virt. What ever the setup is doing is causing a conflict even when the ros is set up outside the virtual env.


Originally posted by rnunziata on ROS Answers with karma: 713 on 2017-05-03

Post score: 1


Original comments

Comment by lakehanne on 2017-05-03:
Try this: reinstall opencv3 while in the virtualenvs and specify the target install path to your virtualenvs opencv3 desired directory using CMAKE_INSTALL_PPREFIX=/your/desired/venv/directory

Comment by rnunziata on 2017-05-04:
Thanks....I will keep this i mind for future reference. Right now I can use both enviroments by just commenting on/off the source lines in the .bashrc file.

Comment by Daniel Tobon on 2017-08-12:
what line in .bashrc file?

Comment by rnunziata on 2017-08-12:
if false; then workon cvp3 export OPENCV_VERSION=3 else
source /opt/ros/kinetic/setup.bash source ~/catkin_ws/devel/setup.bash

Comment by waschbaer00 on 2018-03-07:
I am quite curious on this question, could you share more you know, give more instructions.

1 Answers1

0

Rosanswers logo

Right now I can use both environments by just commenting on/off the source lines in the .bashrc file. I am closing this a good enough work around solution.


Originally posted by rnunziata with karma: 713 on 2017-05-04

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by waschbaer00 on 2018-03-07:
However if you comment on or off everytime, this means you can not run ROS and your program depend on vitual env simutanously, right?

Comment by waschbaer00 on 2018-03-07:
BTW, if the python is global(which is not your case, but maybe could inspire you) you don't need to comment on or off, try to add export $PYTHONPATH with your global python path in ~/.bashrc, as the same time, keep the source line for ros. Then open new terminal, python3, import cv2. It works for m

Comment by rnunziata on 2018-06-24:
Thanks for your suggestion ... I no longer have this set up but will keep this solution in mind if I run across this again.