解决sudo rosdep init和rosdep update各种疑难杂症

问题描述:

环境:ubuntu18+ROS molodic full-desktop
在安装ROS的时候,最后两步骤sudo rosdep init和rosdep update出现各种问题,以此记录各种疑难杂症的解决方案。

一、sudo rosdep init

Error1:ERROR: cannot download default sources list from:

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.

解决:
ping该网址,发现能ping通

ping raw.githubusercontent.com

PING raw.githubusercontent.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.012 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.011 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.016 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.010 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.011 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.013 ms
64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.014 ms
^C
--- raw.githubusercontent.com ping statistics ---

因此,于是修改hosts文件,加入以下两个网址的IP地址实现访问。

sudo gedit /etc/hosts

199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

Error2:ERROR: default sources list file already exists:

解决了上一个问题后,继续执行,会有新的报错

sudo rosdep init 
ERROR: default sources list file already exists:
	/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
(base) twilight@pc: /etc/ros/rosdep/sources

原因及解决:由于已经生成了20-default.list,报错中提示需要删除,因此删除后再执行。

sudo rm 20-default.list
sudo rosdep init 

Error3:ERROR: Rosdep experienced an error: (‘The read operation timed out’,) / SSLError: (‘The read operation timed out’,)

解决了上一个问题后,继续执行,会有新的报错

(base) twilight@pc: /etc/ros/rosdep/sources.list.d$ sudo rosdep init

ERROR: Rosdep experienced an error: ('The read operation timed out',)
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.21.0

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 146, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 441, in _rosdep_main
    return _no_args_handler(command, parser, options, args)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 450, in _no_args_handler
    return command_handlers[command](options)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 594, in command_init
    data = download_default_sources_list()
  File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 340, in download_default_sources_list
    f = urlopen(url, timeout=DOWNLOAD_TIMEOUT)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1248, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1208, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1178, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 452, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 408, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
  File "/usr/lib/python2.7/ssl.py", line 754, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 641, in read
    v = self._sslobj.read(len)
SSLError: ('The read operation timed out',)

解决:
1.在~/.bashrc中添加一句conda deactivate

code  ~/.bashrc
conda deactivate

2.延长timeout

sudo pip install --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple pip
pip --default-timeout=100 install django

至此,第一步rosdep init解决。

二、rosdep update

在运行rosdep update时会出现(‘The read operation timed out’,)的报错,这是由于网络原因,访问超时。

$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
ERROR: error loading sources list:
	('The read operation timed out',)

解决:
用proxychains挂命令行agejt
对于怎么设置proxychains,见博主另一篇博文:
命令行 agent: proxychains配置
解决ROS中rosdep update超时的问题

$ proxychains rosdep update
ProxyChains-3.1 (http://proxychains.sf.net)
reading in sources list data from /etc/ros/rosdep/sources.list.d
|S-chain|-<>-127.0.0.1:1080-<><>-199.232.28.133:443-<><>-OK
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.108.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.108.133:443-<><>-OK
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.111.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.111.133:443-<><>-OK
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.110.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.110.133:443-<><>-OK
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.111.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.111.133:443-<><>-OK
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.109.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.109.133:443-<><>-OK
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.111.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.111.133:443-<><>-OK
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"
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.110.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.110.133:443-<><>-OK
Add distro "galactic"
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.110.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.110.133:443-<><>-OK
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"
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.108.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.108.133:443-<><>-OK
Add distro "noetic"
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.108.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.108.133:443-<><>-OK
Add distro "rolling"
|DNS-request| raw.githubusercontent.com 
|S-chain|-<>-127.0.0.1:1080-<><>-4.2.2.2:53-<><>-OK
|DNS-response| raw.githubusercontent.com is 185.199.109.133
|S-chain|-<>-127.0.0.1:1080-<><>-185.199.109.133:443-<><>-OK
updated cache in /home/twilight/.ros/rosdep/sources.cache
twilight@pc: /etc/ros/rosdep/sources.list.d$ 

相关链接:
rosdep init ROS安装问题解决方案
“SSLError: The read operation timed out” when using pip

  • 15
    点赞
  • 52
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值