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

Hi guys. I have built ROS from source on my PI 2 but I am unable to import libraries.

asked 2016-03-17 00:29:51 -0500

nishthapa gravatar image

updated 2016-03-18 01:38:07 -0500

I am not being able to import even the basic libraries such as with from std_msgs import Stringsin my python scripts. Please help me fix this issue.


This is my CMakeLists.txt :

cmake_minimum_required(VERSION 2.8.3)

find_package(catkin REQUIRED COMPONENTS

 ##INCLUDE_DIRS include
 ##LIBRARIES ior_internet
 ##CATKIN_DEPENDS roscpp rospy std_msgs
 ##DEPENDS system_lib

And this is my package.xml :

<?xml version="1.0"?>
<description>The ior_internet package</description>



edit retag flag offensive close merge delete


This is not enough information

However, this could be a dependency issue, if you installed everything correctly. Please post your CMakeLists.txt as well as the package.xml (and also remove any comments, please).

mgruhler gravatar image mgruhler  ( 2016-03-17 01:18:23 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-03-21 01:47:11 -0500

nishthapa gravatar image

I figured it out. It was because I was not doing #!/usr/bin/env python at the beginning of my scripts. It seems it is important. Now my scripts work as expected.

edit flag offensive delete link more

answered 2016-03-18 01:45:07 -0500

mgruhler gravatar image

Duh, my bad. Could have seen this before.

The import statements for messages within rospy should look like this:

from std_msgs.msg import String
edit flag offensive delete link more


I tried that but i still get the same error. I cant import anything. Not even import rospy

nishthapa gravatar image nishthapa  ( 2016-03-18 02:12:34 -0500 )edit

Have you sourced /opt/ros/indigo/setup.bash? Or the respective workspace?

mgruhler gravatar image mgruhler  ( 2016-03-18 12:24:32 -0500 )edit

Yes, I did that.

nishthapa gravatar image nishthapa  ( 2016-03-21 01:44:11 -0500 )edit

Question Tools

1 follower


Asked: 2016-03-17 00:29:51 -0500

Seen: 99 times

Last updated: Mar 21 '16