rosdep update错误失败一直timeout解决方法

更新rosdep

终端输入

rosdep update

失败1.The read operation timed out(包括ERROR: unable to process source,ERROR: error loading sources list:
) 原因都是外网网址访问不稳定(可多尝试几次rosdep update
)


 多次尝试依然报错可尝试下面的解决方法

解决办法
第一步.把相关文件下载到本地:(注意:下面代码中nice换为你的用户名)
 

git clone https://github.com/ros/rosdistro.git /home/nice/robot

如网络不好无法Git下载可以在下面我分享的百度网盘链接下载压缩包然后解压提取到主目录下

链接:https://pan.baidu.com/s/1ZjMcvqOvLRa_iTdXis8ufg 
提取码:01e2

第二步.改去rosdep update获取文件的网址换为本地地址: 

1.终端输入(注意:下面代码以Ubuntu20.04为例,18.04将下面代码中python3改为python2.7即可)

sudo gedit /usr/lib/python3/dist-packages/rosdep2/rep3.py

输入后回车会弹出rep3.py文件将原来文件中的 REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml' 替换成 REP3_TARGETS_URL = 'file:///home/nice/robot/releases/targets.yaml'(此处nice改为你的用户名因为此处的具体地址为你下载到本地的文件的地址。)

 

 Ctrl+S保存并退出

2.终端输入(注意:下面代码以Ubuntu20.04为例,18.04将下面代码中python3改为python2.7即可)

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

输入回车后会弹出__init__.py文件将原来文件中的 DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'替换成 DEFAULT_INDEX_URL = 'file:///home/nice/robot/index-v4.yaml'(此处nice改为你的用户名因为此处的具体地址为你下载到本地的文件的地址。)

3.修改/etc/ros/rosdep/sources.list.d/20-default.list中的网址为本地地址

终端输入(注意:下面代码以Ubuntu20.04为例,18.04将下面代码中python3改为python2.7即可)
 

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

输入回车后会弹出20-default.list文件将原来文件中的所有 raw.githubusercontent.com开头的网址替换成对应文件在本地的路径(可将下面代码更换20-default.list中的代码注意:代码中的nice全部更换为你的用户名)

# os-specific listings first
yaml file:///home/nice/robot/rosdep/osx-homebrew.yaml osx
 
# generic
yaml file:///home/nice/robot/rosdep/base.yaml
yaml file:///home/nice/robot/rosdep/python.yaml
yaml file:///home/nice/robot/rosdep/ruby.yaml
gbpdistro file:///home/nice/robot/releases/fuerte.yaml fuerte
 
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

修改为如下图后保存退出(注意:代码中的nice全部更换为你的用户名)

然后再次rosdep update一般99%几率成功,如果不成功可评论或私信我

rosdep update成功 

来源:Iamsonice

物联沃分享整理
物联沃-IOTWORD物联网 » rosdep update错误失败一直timeout解决方法

发表评论