Solution to the failure of ROS noetic initialization (rosdep init)

This method focuses on

 

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list

I. Download rosdistro files manually
rosdistro is downloaded to the home directory by default

git clone https://github.com/ros/rosdistro.git

2.Modify 20-default.list

The terminal enters the following command to get the path of the home directory

pwd

Enter rosdistro/rosdep/sourceslist. D, open the 20-default.list file, and

https://raw.githubusercontent.com/ros/rosdistro/master

Amend to read

file:///home/username/rosdistro

Where/home/username is the path obtained by PWD command

3. Modify py file

1. Modification__ init__. py

cd ~/usr/lib/python3/dist-packages/
sudo gedit ./rosdistro/__init__.py

Convert DEFAULT_INDEX_URLs to

DEFAULT_INDEX_URL=” file:///home/username/rosdistro/index-v.yaml “

2, correct3.py

sudo gedit ./rosdep2/rep3.py

Change REP3_TAGETS_URL to

REP3_TAGETS_URL=”file:///home/username/rosdistro/releases/targets.yaml”

3. Modify sources_list.py

sudo gedit ./rosdep2/sources_list.py

Change DEFAULT_SOURCES_LIST_URL to

DEFAULT_SOURCES_LIST_URL=”file:///home/username/rosdistro/rosdep/sources.list.d/20-default.list”

4. Modify gbpdistro_support.py

sudo gedit ./rosdep2/gbpdistro_support.py

Change FUTURE_GBPDISTRO_URL to

FUTURE_GBPDISTRO_URL=”file:///home/username/rosdistro/releases/future.yaml”

4. Reinitialization

sudo rosdep init
rosdep update

Read More: