Ask Your Question
0

How to set the third party python package on ROS?

asked 2017-06-21 15:27:10 -0500

amar gravatar image

I have installed googlemaps, numpy and polyline using pip install command on ubuntu 16.04. As I run the code using sudo python code.py, it works. But, When I use rospy in code and run it as rosrun package code.py the code doesn't work. It shows problem in connecting googlemap API. I want to include these python packages(googlemaps..) on ROS so that the code works on ROS. How to do it?

edit retag flag offensive close merge delete

Comments

Why do you run it with sudo? Do you get errors running code.py without sudo?

ufr3c_tjc gravatar image ufr3c_tjc  ( 2017-06-21 17:55:33 -0500 )edit

to run a pyhton script i use sudo. Without sudo i get errors as ros can't find the pyhton packages which i installed using pip. I just want to know how to use googlemaps , numpy and polyline on ROS. I want to know how to run the code with these modules using rosrun.

amar gravatar image amar  ( 2017-06-22 00:49:30 -0500 )edit

Using sudo is almost never necessary, and should certainly not be required for starting regular Python scripts that load a few libraries. Did you use a virtualenv to install your libraries? Can you tell us the output of:

$ python
...
>>> import numpy <enter>
gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 02:15:46 -0500 )edit

And perhaps also: which python?

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 02:23:14 -0500 )edit

python- 2.7.12 . I installed those packages using pip install command. I want to run the python script using rosrun so that i can publish data. But when i use rosrun the code doesn't work. using sudo to run the code is not a concern

amar gravatar image amar  ( 2017-06-22 02:43:30 -0500 )edit

using sudo to run the code is not a concern

it is a concern, as it should not be necessary and seems to point to 'larger' problems with your setup / configuration.

pip-installed modules should be usable under any account. And should also work 'with ROS'.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 03:22:40 -0500 )edit

Can you tell us what the output is of echo $PYTHONPATH? Both before and after you have sourced setup.bash?

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 03:23:16 -0500 )edit

Also: please edit your original question and include the errors that you encounter when trying to run your node using rosrun. Use the Preformatted Text button (the one with 101010 on it) to format everything properly.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 03:24:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-22 06:55:03 -0500

amar gravatar image

Thanks!! I solved the problem. I tried again by creating a catkin workspace and it works using rosrun.

edit flag offensive delete link more

Comments

So it was a configuration error.

Good to hear that you resolved it.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-22 06:58:49 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-06-21 15:27:10 -0500

Seen: 506 times

Last updated: Jun 22 '17