The method to solve the failure of sudo rosdep init and rosdep update in the ROS system in Ubuntu18.04 (the actual test is very useful!)

1. Enter sudo rosdep init, and the problem of sudo: rosdep: command not found appears

Solution: Install the corresponding package

sudo apt-get install python-rosdep

2. Enter sudo rosdep init and ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list Website may be down.

Solution: remove the previously installed package

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

3、输入 rosdep update出现 reading in sources list data from /etc/ros/rosdep/sources.list.d Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml ERROR: error loading sources list: ('The read operation timed out',)

Solution: Modify some functions.

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

After opening the file, press Ctrl+F to find the download_rosdep_data function, and add it to the first line of the function

url="https://ghproxy.com/"+url

Modify DEFAULT_INDEX_URL in /usr/lib/python2.7/dist-packages/rosdistro/__init__.py in the same way

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

After opening the file, press Ctrl+F to find DEFAULT_INDEX_URL and change it to:

DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

Now you can retype rosdep update and it will work!

Guess you like

Origin blog.csdn.net/m0_74923682/article/details/129405081