ROS Melodic rosdep update
环境:
系统:Ubuntu Bionic(18.04.6)
ros: ROS Melodic ( ROS 1 LTS)
Python: 3.6.9
rosdep: 0.21.0
前言
raw.githubusercontent.com的资源访问不稳定,使用https://ghproxy.co…
1. 安装 rosdep
$ sudo apt-get install python3-pip
$ sudo pip install -U rosdep -i https://pypi.tuna.tsinghua.edu.cn/simple
$ rosdep --version
0.21.0
注意以下命令可能删除已经安装的ros基础环境:【不推荐】
sudo apt install python3-rosdep2
2. rosdep init
$ sudo rosdep init
rosdep初始化失败解决办法:
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.
使用代理手动下载到指定位置
$ sudo mkdir -p /etc/ros/rosdep/sources.list.d
$ cd /etc/ros/rosdep/sources.list.d
$ sudo wget https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
内容:
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
3. rosdep update
$ rosdep update
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)>
使用代理修改下载地址
- 修改20-default.list
$ sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
内容
# os-specific listings first
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
- 修改python3的__init__.py
sudo gedit /usr/local/lib/python3.6/dist-packages/rosdistro/__init__.py
内容
DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
修改为
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
- 修改gbpdistro_support.py【解决fuerte.yaml失败问题】
$ sudo gedit /usr/local/lib/python3.6/dist-packages/rosdep2/gbpdistro_support.py
第204行
try:
gbpdistro_url = 'https://ghproxy.com/' + gbpdistro_url
f = urlopen(gbpdistro_url, timeout=DOWNLOAD_TIMEOUT)
- 其他修改
/usr/local/lib/python3.6/dist-packages/rosdep2/gbpdistro_support.py 36行
/usr/local/lib/python3.6/dist-packages/rosdep2/sources_list.py 72行
/usr/local/lib/python3.6/dist-packages/rosdep2/rep3.py 39行
/usr/local/lib/python3.6/dist-packages/rosdistro/manifest_provider/github.py 68行 119行