Get an error when import tf2_ros

asked 2021-03-06 12:07:01 -0600

Mineweeper gravatar image

I'm a noob in ROS. When I tried to import tf2_ros. It get error like below. But i do can import some other modules like tf2_msgs or tf2_kdl. My Ubuntu version is 16.04 ,Python version 2.7.12, ROSdistro kinetic . Could anyone help me handle this problem? Thanks.

> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/__init__.py", line 39, in <module>
    from .buffer_interface import *
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/buffer_interface.py", line 32, in <module>
    import roslib; roslib.load_manifest('tf2_ros')
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py", line 62, in load_manifest
    sys.path = _generate_python_path(package_name, _rospack) + sys.path
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py", line 93, in _generate_python_path
    m = rospack.get_manifest(pkg)
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 171, in get_manifest
    return self._load_manifest(name)
  File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 215, in _load_manifest
    retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self)
  File "/usr/lib/python2.7/dist-packages/rospkg/manifest.py", line 410, in parse_manifest_file
    from rosdep2.rospack import init_rospack_interface, is_ros_package, is_system_dependency, is_view_empty
  File "/usr/lib/python2.7/dist-packages/rosdep2/__init__.py", line 45, in <module>
    from .lookup import RosdepDefinition, RosdepView, RosdepLookup, \
  File "/usr/lib/python2.7/dist-packages/rosdep2/lookup.py", line 44, in <module>
    from .sources_list import SourcesListLoader
  File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 50, in <module>
    from .gbpdistro_support import get_gbprepo_as_rosdep_data, download_gbpdistro_as_rosdep_data
  File "/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py", line 18, in <module>
    from .platforms.debian import APT_INSTALLER
  File "/usr/lib/python2.7/dist-packages/rosdep2/platforms/debian.py", line 45, in <module>
    from .pip import PIP_INSTALLER
  File "/usr/lib/python2.7/dist-packages/rosdep2/platforms/pip.py", line 33, in <module>
    import pkg_resources
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1365
    raise SyntaxError(e) from e
                      ^
SyntaxError: invalid syntax
edit retag flag offensive close merge delete