package ‘catkin‘ depends on non-existent package ‘python3-catkin-pkg‘

这个问题的出现有点莫名其妙,不知道是在怎样的情况下触发的. 总之,现象就是: 之前可以很好地编译的ROS下的ORBSLAM的文件都无法再编译了, 每次提示如下:

[rosbuild] Building package ORB_SLAM2
Failed to invoke /opt/ros/kinetic/bin/rospack deps-manifests ORB_SLAM2
[rospack] Error: package 'catkin' depends on non-existent package 'python3-catkin-pkg' and rosdep claims that it is not a system dependency. Check the ROS_PACKAGE_PATH or try calling 'rosdep update'


CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:129 (message):
  

  Failed to invoke rospack to get compile flags for package 'ORB_SLAM2'.
  Look above for errors from rospack itself.  Aborting.  Please fix the
  broken dependency!

Call Stack (most recent call first):
  /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:207 (rosbuild_invoke_rospack)
  CMakeLists.txt:4 (rosbuild_init)

检查了一下Ros下的catkin的依赖文件,其中有如下几行: 

  <depend condition="$ROS_PYTHON_VERSION == 2">python-argparse</depend>
  <depend condition="$ROS_PYTHON_VERSION == 2" version_gt="0.4.3">python-catkin-pkg</depend>
  <depend condition="$ROS_PYTHON_VERSION == 3" version_gt="0.4.3">python3-catkin-pkg</depend>

推测是之前来回切换python的版本导致的, 接下来说一下我的整个解决过程,最正确的步骤在最后, 大家可以直接翻到最后, 中间步骤中有一些坑,也要注意一下:

1. 首先我检查了一下自己当前电脑的python版本, 用update-alternatives 切换到了python2的版本

update-alternatives --config python

2. 然后安装python3-catkin-pkg , 但是安装的时候出现了提醒就是会有280个软件被卸载,也就是ros-kinect相关的软件都会被删除, 这就很头大了,千万不要同意,否则一切就白费了 

可以安装 sudo apt-get install python3-catkin-pkg-modules 试一下, 但是安装之后其实还是不能解决问题的, 同时像sudo apt-get install ros-kinetic-catkin 重新安装catkin的命令也执行了, 但是并不管用;

3. 看到上面问题的提醒, 让运行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)>

总结来讲就是Connection refused. (应该不是VPN的问题, 因为我在科学上网,可以连接外网)

于是找到了这篇博客: rosdep更新不了的问题

博主遇到的问题是Connection Timeout, 而我的问题是connection refused, 抱着试试看的心态跟着做了一下, 具体如下:

分别运行:

sudo vi /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
sudo vi /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
sudo vi /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

在文件中找到 :/DOWNLOAD_TIMEOUT 由15修改为25后保存;

同时在下面文件中添加新的host, 即可完成.

sudo gedit /etc/hosts
151.101.84.133  raw.githubusercontent.com

重新运行rosdep update 和ORBSLAM的编译, 都可以了;
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值