This is a place that is prone to errors. Generally, there are no errors in the front, and it is easy to solve if there are errors. The errors in this place are generally not easy to solve
sudo rosdep init
For this pormpt
ERROR: cannot download default sources list from. I tried many methods. I also mentioned this problem in my previous blog post. Changing hotspots, modifying hosts files, etc., these are some indicators that do not cure the root cause. Run There will still be errors when
ros updata. The reason for the error is that there is an error when accessing
raw.githubusercontent.com for some well-known reasons. The fundamental solution is given below.
The idea is: change all the url addresses to the addresses of the local downloaded packages
1. Go to
github.com/ros/rosdistro to download this package. After downloading, place it in your root directory file, and make sure that the name of the package is rosdistro. It can only be this name. Rename it if it is inconsistent. .
2. Modify the file
20-default.list under rosdistro
rosdep/source.list.d/ to modify all the URL addresses in this file that point to raw.githubusercontent.com to point to the address of the local file. (My file name is zsl, Change this to your own file name
xxx, don't change the others, just copy it directly.
# os-specific listings first yaml file:///home/zsl/rosdistro/rosdep/osx-homebrew.yaml osx # generic yaml file:///home/zsl/rosdistro/rosdep/base.yaml yaml file:///home/zsl/rosdistro/rosdep/python.yaml yaml file:///home/zsl/rosdistro/rosdep/ruby.yaml gbpdistro file:///home/zsl/rosdistro/releases/fuerte.yaml fuerte
3. Modify the default url in
sources_list.py under the folder
/usr/lib/python2.7/dist-packages/rosdep2 in the computer directory (my file name is zsl, this is changed to your own file name
xxx, others Don’t change, just copy it.
# default file to download with 'init' command in order to bootstrap # rosdep DEFAULT_SOURCES_LIST_URL = 'file:///home/zsl/rosdistro/rosdep/sources.list.d/20-default.list' # seconds to wait before aborting download of rosdep data
4. My file name is zsl. Change this to your own file name xxx. Don’t change the others, just copy it directly.
# location of targets file for processing gbpdistro files REP3_TARGETS_URL = 'file:///home/zsl/rosdistro/releases/targets.yaml' # seconds to wait before aborting download of gbpdistro data
5. My file name is zsl, change this to your own file name xxx, don't change the others, just copy it directly.
# index information DEFAULT_INDEX_URL = 'file:///home/zsl/rosdistro/index-v4.yaml' def get_index_url():
Note, if you do not have permission to modify, open the terminal in the modified file directory
sudo chmod 777 xxxxx
Then modify it. (If you have any questions, please leave a message in time)
After the modification is completed, try to initialize rosdep again
sudo rosdep init