rosdep update encountered ERROR

created at 06-10-2022 views: 5

problem

rosdep update encounter

ERROR: reading in sources list data from /etc/ros/rosdep/sources.list.d ERROR: unable to process source

reason

The URL that rosdep update needs to access cannot be entered, so an error is reported

solution

When doing rosdep update, visit raw.githubusercontent.com, which is actually the user data server of github. The rosdep program downloads the yaml file in the github.com/ros/rosdistro package. Therefore, an idea is: first download the github.com/ros/rosdistro package, and change the default url addresses in the following files to the raw.githubusercontent.com to download files to the local downloaded package the address of.

S1: Download the source code

Go to github.com/ros/rosdistro to download the package. Put it in the /home/xxx directory (ie the home directory)

S2: Modify the code in the 20-default.list file

sudo gedit /home/yourname/rosdistro/rosdep/sources.list.d/20-default.list 

Modify the file 20-default.list under rosdep/source.list.d/ in this package, and change all the url addresses pointing to raw.githubusercontent.com in this file to the addresses pointing to local files , which is the address of the downloaded package:

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

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

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

Note: In the py language, the url local file address format is: file://+file address, which is the same when changing the address in other files later.

S3: Modify the code in the sources_list.py file

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

Inside the sources_list.py file under the /usr/lib/python2.7/dist-packages/rosdep2 folder. The code in this file accesses raw.githubusercontent.com, so you can modify the default url.

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

# seconds to wait before aborting download of rosdep data

S4: Modify the code in the gbpdistro_support.py file

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
FUERTE_GBPDISTRO_URL = 'file:///home/xxx/rosdistro/' \
     'releases/fuerte.yaml'

S5: Modify the code in the rep3.py file

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
# location of targets file for processing gbpdistro files
REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'

# seconds to wait before aborting download of gbpdistro data

S6: Modify the code in the __init__.py file

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

DEFAULT_INDEX_URL = 'file:///home/xxx/rosdistro/index-v4.yaml'

def get_index_url():

S7: final execution

sudo apt-get update
rosdep update

The result looks like this:

continue

A new and more convenient method was discovered later:

1.Install pip or pip3

sudo apt-get install python3-pip #pip can be changed to pip3

2.Install rosdepc

sudo pip3 install rosdepc

3.Initialize

sudo rosdepc init
rosdepc update

4.End (specially recommended)! ! ! !

created at:06-10-2022
edited at: 06-10-2022: