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

rosdep init fails with a syntax error

asked 2020-12-16 20:27:32 -0500

ajtoth gravatar image

updated 2020-12-16 20:29:11 -0500

Let me set the stage: I'm running an older 32-bit platform, so I'm running Ubuntu 16.04. I'm following the "build Foxy from source" tutorial: https://index.ros.org/doc/ros2/Instal... At the step to run sudo rosdep init, this is the error I get:

nc10user@nc10user-NC10:~/ros2_foxy$ sudo rosdep -E init
Traceback (most recent call last):
  File "/usr/bin/rosdep", line 10, in <module>
    from importlib.metadata import distribution
ImportError: No module named 'importlib.metadata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/rosdep", line 13, in <module>
    from importlib_metadata import distribution
  File "/home/nc10user/.local/lib/python3.5/site-packages/importlib_metadata/__init__.py", line 88
    dist: Optional['Distribution'] = None
        ^
SyntaxError: invalid syntax
nc10user@nc10user-NC10:~/ros2_foxy$

my ROS env is tainted from a previous ROS1 install of kinetic, see my ROS env

nc10user@nc10user-NC10:~/ros2_foxy$ env | grep ROS
ROS_ROOT=/opt/ros/kinetic/share/ros
ROS_PACKAGE_PATH=/opt/ros/kinetic/share
ROS_MASTER_URI=http://localhost:11311
ROS_PYTHON_VERSION=2
ROS_VERSION=1
ROSLISP_PACKAGE_DIRECTORIES=
ROS_DISTRO=kinetic
ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
edit retag flag offensive close merge delete

Comments

1

I am wondering if this has anything to do with your OS since Foxy is primarily supported on Ubuntu 20.04

MakinoharaShouko gravatar image MakinoharaShouko  ( 2020-12-16 21:35:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-12-18 12:45:28 -0500

clalancette gravatar image

Yeah, Ubuntu 16.04 is going to be a problem. The python version there is going to be way out of date. You may be able to get by this error by running pip3 install importlib-metadata, but I'm guessing there are other things that aren't going to work.

For what it is worth, we do some minimal testing of Foxy on 18.04, even though it isn't officially supported. I think you'll have a much better time if you try that.

edit flag offensive delete link more

Comments

Thank you! You made me learn there is more than apt-get dist upgrade (do-release-upgrade) and I made it to 18.04 (it took 2 days) I was building from source and when I ran rosdep init, it threw back an error saying

 sudo rosdep init
ERROR: default sources list file already exists:
    /etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

and I misinterpreted that and ran sudo rosdep install (copy/pasted from applicable step), which failed at:

E: Unable to locate package python3-lark-parser
ERROR: the following rosdeps failed to install
  apt: command [sudo -H apt-get install -y python3-lark-parser] failed

Re-attempting sudo apt update/install python3-lark-parser failed, being unable to locate the package. So I suppose there's nothing left to do except admit defeat. Back me up here? (Am I right that this is a dead end?)

ajtoth gravatar image ajtoth  ( 2020-12-19 13:10:10 -0500 )edit

Things should work out if you are on 18.04; as I mentioned, it is something we test (although only minimally).

What I would do here is to follow the instructions from rosdep, and remove /etc/ros/rosdep/sources.list.d/20-default.list. Then follow the instructions at https://index.ros.org/doc/ros2/Instal... to reinitialize everything.

clalancette gravatar image clalancette  ( 2021-01-04 13:55:35 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2020-12-16 20:27:32 -0500

Seen: 1,233 times

Last updated: Dec 18 '20