系统:ubuntu18.04

系统:ubuntu18.04

ros:ros-melodic

大部分解决办法转载自:https://zhuanlan.zhihu.com/p/392082731

1.sudo rosdep init报错(切换为手机热点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.11.8

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 137, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 381, in _rosdep_main
    return _no_args_handler(command, parser, options, args)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 389, in _no_args_handler
    return command_handlers[command](options)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 516, in command_init
    data = download_default_sources_list()
  File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 318, 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',)

2.sudo rosdep update报错

reading in sources list data from /etc/ros/rosdep/sources.list.d
Warning: running 'rosdep update' as root is not recommended.
  You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
^CTraceback (most recent call last):
  File "/usr/bin/rosdep", line 4, in <module>
    rosdep_main()
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 137, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 381, in _rosdep_main
    return _no_args_handler(command, parser, options, args)        
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 389, in _no_args_handler
    return command_handlers[command](options)
  File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 579, in command_update
    error_handler=update_error_handler)
  File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 452, in update_sources_list
    rosdep_data = download_rosdep_data(source.url)
  File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 294, in download_rosdep_data
    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)

解决方法:

这里为大家写出详细的命令:

1.打开包含资源下载函数的文件:

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

2. 添加代理:

url="https://ghproxy.com/"+url

下面是代码修改的位置

3. 修改/usr/lib/python2.7/dist-packages/rosdistro/__init__.py文件中的DEFAULT_INDEX_URL

$ sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

4. 修改其余(4个)文件中的地址,在地址 https://raw.githubusercontent.com/... 前添加https://ghproxy.com/(我自身的情况,在这四个文件中,只有第二个跟第四个是https://raw.githubusercontent.com/...        第一个跟第三个是在对应的行上有https://raw.github.com/ros/rosdistro/..方法也是在前面加上https://ghproxy.com/

$ sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
//修改第36行的地址
$ sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py 72行
//修改第72行
$ sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
//修改第39行
$ sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py
//修改第68行、119行

5. 解决 Hit 第五个地址的报错

$ sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py 
//在第204行添加如下代码(即在该函数块下的第一行处)
gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url
//注意,原网址中代理地址的双引号是中文,直接粘贴复制会报字符识别错误

6. 再次运行 rosdep update ,发现问题完美解决!

7.对于自身情况再次运行 rosdep update问题没有解决,而是出现了下错误(上面文章里的第5步并没有效果):

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
Hit 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:
	HTTP Error 403: FORBIDDEN
Query rosdistro index https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Add distro "ardent"
Add distro "bouncy"
Add distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Add distro "groovy"
Add distro "hydro"
Add distro "indigo"
Add distro "jade"
Add distro "kinetic"
Add distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/zcy/.ros/rosdep/sources.cache
ERROR: Not all sources were able to be updated.
[[[
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	HTTP Error 403: FORBIDDEN
]]]

ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
    Failed to download target platform data for gbpdistro:
    HTTP Error 403: FORBIDDEN
]]]

8.继续寻找解决办法——直接下载源文件进行替换

使用这个方法需要将上面方法改过的内容先还原!!!

使用这个方法需要将上面方法改过的内容先还原!!!

使用这个方法需要将上面方法改过的内容先还原!!!

转载:https://zhuanlan.zhihu.com/p/377780797

1.git clone

ros/rosdistro​github.com/ros/rosdistro.git

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

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

# generic
yaml file:///home/yourname/rosdistro/rosdep/base.yaml
yaml file:///home/yourname/rosdistro/rosdep/python.yaml
yaml file:///home/yourname/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/yourname/rosdistro/releases/fuerte.yaml fuerte
4.将文件中的网址替换为你的文件路径,将"raw.githubusercontent.com"修改为/home/yourname/rosdistro/rosdep

下面三个文件中也要修改,修改方式同上,查看你的python2.7
/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

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
# FUERTE_GBPDISTRO_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml'
FUERTE_GBPDISTRO_URL = 'file:///etc/ros/rosdistro-master/releases/fuerte.yaml'

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
# REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
REP3_TARGETS_URL = 'file:etc/ros/rosdistro-master/releases/targets.yaml'

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
# DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro-master/index-v4.yaml'

下面三个文件中也要修改,修改方式同上,查看你的python3
5.cd /usr/lib/python3/dist-packages/rosdep2/
6.sudo gedit gbpdistro_support.py

FUERTE_GBPDISTRO_URL = 'file:///home/yourname/rosdistro/' \
    'releases/fuerte.yaml'

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

9.cd /usr/lib/python2.7/dist-packages/rosdistro/
10.sudo gedit __init__.py

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

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

#os-specific listings first
yaml file:///home/yourname/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///home/yourname/rosdistro/rosdep/base.yaml
yaml file:///home/yourname/rosdistro/rosdep/python.yaml
yaml file:///home/yourname/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/yourname/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

 操作过程中遇到的问题:1.我在python3下没有rosdep2这个文件夹,所以第5~8步骤没有执行;2.第9~10步骤与上面第4步中的在__init__.py文件中的操作冲突,我选择执行第4步,没有执行9~10步骤。

按照上面的步骤执行完,再次rosdep update出现的问题:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/zcy/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/zcy/rosdistro/rosdep/base.yaml
Hit file:///home/zcy/rosdistro/rosdep/python.yaml
Hit file:///home/zcy/rosdistro/rosdep/ruby.yaml
ERROR: unable to process source [file:///home/zcy/rosdistro/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error [Errno 2] No such file or directory: 'etc/ros/rosdistro-master/releases/targets.yaml'>
Query rosdistro index https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/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/zcy/.ros/rosdep/sources.cache
ERROR: Not all sources were able to be updated.
[[[
ERROR: unable to process source [file:///home/zcy/rosdistro/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error [Errno 2] No such file or directory: 'etc/ros/rosdistro-master/releases/targets.yaml'>
]]]

解决方法:根据<urlopen error [Errno 2] No such file or directory: 'etc/ros/rosdistro-master/releases/targets.yaml'>可知问题为打开targets.yaml文件失败,因此重新给定路径:

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
# REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
# REP3_TARGETS_URL = 'file:etc/ros/rosdistro-master/releases/targets.yaml'
REP3_TARGETS_URL = 'file:///home/zcy/rosdistro/releases/targets.yaml'

问题解决!

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐