ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

python virtualenvs conflict with kinetic

asked 2017-05-03 20:20:03 -0500

rnunziata gravatar image

updated 2017-05-03 20:31:34 -0500

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.

edit retag flag offensive close merge delete

Comments

1

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

lakehanne gravatar image lakehanne  ( 2017-05-03 23:51:13 -0500 )edit

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.

rnunziata gravatar image rnunziata  ( 2017-05-04 13:08:15 -0500 )edit

what line in .bashrc file?

Daniel Tobon gravatar image Daniel Tobon  ( 2017-08-12 16:15:16 -0500 )edit

if false; then workon cvp3 export OPENCV_VERSION=3 else
source /opt/ros/kinetic/setup.bash source ~/catkin_ws/devel/setup.bash

rnunziata gravatar image rnunziata  ( 2017-08-12 21:35:39 -0500 )edit

I am quite curious on this question, could you share more you know, give more instructions.

waschbaer00 gravatar image waschbaer00  ( 2018-03-07 15:18:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-05-04 13:09:24 -0500

rnunziata gravatar image

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.

edit flag offensive delete link more

Comments

However if you comment on or off everytime, this means you can not run ROS and your program depend on vitual env simutanously, right?

waschbaer00 gravatar image waschbaer00  ( 2018-03-07 14:59:09 -0500 )edit

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

waschbaer00 gravatar image waschbaer00  ( 2018-03-07 15:16:13 -0500 )edit

Thanks for your suggestion ... I no longer have this set up but will keep this solution in mind if I run across this again.

rnunziata gravatar image rnunziata  ( 2018-06-24 17:18:47 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-05-03 20:20:03 -0500

Seen: 797 times

Last updated: May 04 '17