ERROR: cannot download default sources list from: error solution appears when sudo rosdep init

ERROR: cannot download default sources list from: error solution appears when sudo rosdep init

About the rosdep init error that occurs when installing ROS

sudo rosdep init
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

first step

Many people on the Internet talk about adding various IPs to the /etc/hosts file, but it seems that it cannot be used because it cannot get over the wall. Finally, I tried many methods and found that one of the bloggers' method was very reliable.
First go to Baidu connection to download the file, https://pan.baidu.com/s/1hKFJp_PQaela6i7RMOh5ZA, extraction code: bryv
After downloading, put the file into a folder in ubuntu.

Step 2

Modify the file 20-default.list under rosdep/source.list.d/ in this package, and modify all the URL addresses pointing to raw.githubusercontent.com in this file to the addresses pointing to local files, which is the downloaded package. For the address, you can enter sources.list.d in rosdep in the rosdistro-master folder, enter pwd in the terminal to view the path, copy the path, and then modify the content in 20-default.list.

# os-specific listings first
yaml file:///home/xxx/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/xxx/rosdep/base.yaml
yaml file:///home/xxx/rosdep/python.yaml
yaml file:///home/xxx/rosdep/ruby.yaml
gbpdistro file:///home/xxx/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

Note that it is file://+path;

third step

Go into the files /usr/lib/python2.7/dist-packages/rosdep2under this folder sources_list.py. The code in this file performs access raw.githubusercontent.comoperations, so just modify the default url. Here is an example:

# default file to download with 'init' command in order to bootstrap
# rosdep
DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdep/sources.list.d/20-default.list'

# seconds to wait before aborting download of rosdep data

the fourth step

Modify the code in the following two files:

/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py

They are

# location of targets file for processing gbpdistro files
REP3_TARGETS_URL = 'file:///home/xxx/releases/targets.yaml'
# seconds to wait before aborting download of gbpdistro data
# index information
DEFAULT_INDEX_URL = 'file:///home/xxx/index-v4.yaml'
def get_index_url():

This file is in rosdistro-master and does not need to enter the subdirectory.

at last

Then perform sudo rosdep init:
The exciting moment is here:
Insert image description here
success!
Refer to the original linkhttps://zhuanlan.zhihu.com/p/107218921。

Guess you like

Origin blog.csdn.net/qq_43046763/article/details/116225256