How to set the third party python package on ROS?
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?
Why do you run it with sudo? Do you get errors running code.py without sudo?
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.
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:And perhaps also:
which python
?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
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'.Can you tell us what the output is of
echo $PYTHONPATH
? Both before and after you havesource
dsetup.bash
?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 with101010
on it) to format everything properly.