Ask Your Question
2

How to install and launch Python node inside a virtualenv?

asked 2016-03-07 19:41:52 -0500

Cerin gravatar image

I'm writing a Python ROS node, and all the documentation seems to assume I've installed all my package dependencies into the global site-packages. Best practices in the Python world is to use a virtualenv. However, I can't find anything in the tutorials that mentions this. When launching my node, is it enough to source my virtualenv, or is there some special configuration I need to do first?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-03-09 09:55:46 -0500

sloretz gravatar image

If the python code was written by you and is part of one of your own ROS package then sourcing the ros workspace's devel/setup.bash will make all the python libraries available for import just like virtualenv does. These links should give enough info to set up a ros package to do so.

http://docs.ros.org/jade/api/catkin/h...

https://github.com/ros-infrastructure...

AFAIK there isn't any special configuration needed to use a virtualenv when developing Python nodes. I sourced devel/setup.bash in my ros workspace first, then sourced bin/activate in a virtualenv and found I was able to import modules from both the ros packages and the libraries installed in just the virtualenv.

edit flag offensive delete link more

Comments

Thanks. I've verified this also.

Cerin gravatar imageCerin ( 2016-03-09 11:50:19 -0500 )edit
0

answered 2016-12-03 12:56:14 -0500

It doesn't matter if you have your own ROS package or whatever, virtualenv is a tool to isolate python environments. THe first time I was lost, but I found a guide to learn more about virtualenvs.

Hope it helps!!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2016-03-07 19:41:52 -0500

Seen: 5,033 times

Last updated: Mar 09 '16