Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' #13

Closed
clebio opened this issue Nov 29, 2020 · 21 comments
Closed

ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' #13

clebio opened this issue Nov 29, 2020 · 21 comments
Labels

Comments

@clebio
Copy link

clebio commented Nov 29, 2020

On a new install of Foxy Fitzroy on Ubuntu Focal, I was trying to run roslaunch gazebo_simulation_scene gazebo_simulation_scene.launch. However, that fails with the titular error message. To simply this further, just trying to import roslaunch does the same:

$ python -c 'import roslaunch'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/roslaunch/__init__.py", line 62, in <module>
    from .scriptapi import ROSLaunch
  File "/usr/lib/python3/dist-packages/roslaunch/scriptapi.py", line 42, in <module>
    import roslaunch.parent
  File "/usr/lib/python3/dist-packages/roslaunch/parent.py", line 54, in <module>
    import roslaunch.server
  File "/usr/lib/python3/dist-packages/roslaunch/server.py", line 79, in <module>
    from rosgraph_msgs.msg import Log
ImportError: cannot import name 'Log' from 'rosgraph_msgs.msg' (/opt/ros/foxy/lib/python3.8/site-packages/rosgraph_msgs/msg/__init__.py)

This is on a new ROS setup on Ubuntu:

$ printenv | grep ROS
ROS_VERSION=2
ROS_PYTHON_VERSION=3
ROS_LOCALHOST_ONLY=0
ROS_DISTRO=foxy

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ python -V
Python 3.8.5
@kmindspark
Copy link

Same issue here, is there a solution to this?

@colian
Copy link

colian commented May 17, 2021

Looking forward the answer too.

@EthanCodesss
Copy link

Same issue!!

@JesseSarria
Copy link

Similar issue here, but on eloquent.

@NazarK0
Copy link

NazarK0 commented Jun 15, 2021

similar issue, but on Galactic

@Udaykiran87
Copy link

Udaykiran87 commented Jun 21, 2021

did any one find answer? I am unable to play the rosbag file using ros1 bridge. When i am trying to filter out some topics then also i am not able filter out.

@baharaks
Copy link

Same problem with ROS Foxy.

@boyarzun
Copy link

Same issue with ROS Foxy.

@amplexus
Copy link

Same issue with ROS rolling.

@keli95566
Copy link

Same problem with ROS Foxy.

@hidmic
Copy link
Contributor

hidmic commented Sep 10, 2021

Alright, to answer everyone before closing -- though I presume you've already found out.

This repository only hosts the rosgraph_msgs package for ROS 1. The rosgraph_msgs package for ROS 2 lives in https://github.com/ros2/common_interfaces, but it doesn't hold the Log message anymore. It has been relocated to the rcl_interfaces package.

@Oballon
Copy link

Oballon commented Oct 5, 2021

So, how to solve this issue?

@maxlu96
Copy link

maxlu96 commented Nov 1, 2021

roscore has been replaced in ros2, reed more here:

https://www.theconstructsim.com/ros2-in-5-mins-003-where-is-roscore-in-ros2/

@whwang8
Copy link

whwang8 commented Dec 17, 2021

I don't think you can use ros2 with gazebo, at least it's not the recommended version. If you look at the tutorial, it recommends ros noetic among others. Thought I'd post because I was banging my head against a while with this.

http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros

@whwang8
Copy link

whwang8 commented Dec 17, 2021

http://gazebosim.org/tutorials?tut=ros_wrapper_versions&cat=connect_ros

This shows which combinations of versions you can use!

@maxlu96
Copy link

maxlu96 commented Dec 18, 2021

I don't think you can use ros2 with gazebo, at least it's not the recommended version. If you look at the tutorial, it recommends ros noetic among others. Thought I'd post because I was banging my head against a while with this.

http://gazebosim.org/tutorials?tut=ros_installing&cat=connect_ros

I used ros2 foxy with Gazebo and it workes fine

@t0stiman
Copy link

t0stiman commented Mar 3, 2022

Solution: use ros2 launch instead of roslaunch.

@lisimmy
Copy link

lisimmy commented Jul 7, 2022

$ printenv | grep ROS
ROS_VERSION=2

use ros2 xxx
eg: ros2 topic list

Call ros2 <command> -h for more detailed usage.

@dieter-aerit
Copy link

ros2 launch rosbridge_server rosbridge_websocket_launch.xml solves it in my case.

@devrajshetake
Copy link

I am using ros2 launch still getting the same error.

@KevinKipkorir254
Copy link

Hello found the solution Use
Screenshot (21)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests