rosdep update报错问题的解决

本文档介绍了如何处理初始化rosdep时由于域名污染导致的错误。首先,通过克隆rosdistro仓库来解决无法下载默认源列表的问题。然后,编辑相关配置文件,将远程URL替换为本地克隆仓库的路径。完成这些步骤后,执行rosdep update不再出现连接错误,成功更新了rosdep数据库。
摘要由CSDN通过智能技术生成

初始化 rosdep

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.

为解决该问题,首先,克隆 rosdistro 仓库:

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

然后,本地新建对应目录:

sudo mkdir -p /etc/ros/rosdep/sources.list.d

最后,将克隆下来的 rosdistro 仓库中的 list 文件拷贝到上述目录:

cd rosdistro
sudo cp rosdep/sources.list.d/20-default.list /etc/ros/rosdep/sources.list.d/

更新本地 rosdep 数据库

rosdep update

同样是由于域名污染,这一步往往会报下面的错误:

reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml]:
    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml]:
    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml]:
    <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
    Failed to download target platform data for gbpdistro:
    <urlopen error [Errno 111] Connection refused>
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
ERROR: error loading sources list:
    <urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

假设已经解决上面步骤中 rosdep init 遇到的问题,现在需要编辑以下四个文件:

  • /etc/ros/rosdep/sources.list.d/20-default.list

  • /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py

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

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

搜索文件中的 https://raw.githubusercontent.com/ros/rosdistro/master 字段,将其替换为本地 rosdistro 仓库的绝对地址,例如本示例中为 file:///home/xxx/rosdistro。(xxx对应自己的安装路径)

编辑后的 list 文件如下所示:

# 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

然后重新执行 rosdep update 命令即可:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/xxx/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/xxx/rosdistro/rosdep/base.yaml
Hit file:///home/xxx/rosdistro/rosdep/python.yaml
Hit file:///home/xxx/rosdistro/rosdep/ruby.yaml
Hit file:///home/xxx/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///home/xxx/rosdistro/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/xxx/.ros/rosdep/sources.cache
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值