Failed to build with colcon: "cannot import name 'has_ros_schema_reference'"
Having a clean workspace with single empty folder src
, I source ROS2 by calling
source /opt/ros/dashing/setup.bash
and running colcon build
I get an exception in colcon core package (or catkin_pkg package ?) as displayed below:
[0.164s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros' in '/home/yossi/temp_ws': cannot import name 'has_ros_schema_reference'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 143, in _identify
retval = extension.identify(_reused_descriptor_instance)
File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 59, in identify
pkg, build_type = get_package_with_build_type(str(desc.path))
File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 163, in get_package_with_build_type
pkg = _get_package(path)
File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 171, in _get_package
from catkin_pkg.package import has_ros_schema_reference
ImportError: cannot import name 'has_ros_schema_reference'
[0.166s] ERROR:colcon.colcon_core.package_identification:Exception in package identification extension 'ros' in '/home/yossi/temp_ws/src': cannot import name 'has_ros_schema_reference'
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/colcon_core/package_identification/__init__.py", line 143, in _identify
retval = extension.identify(_reused_descriptor_instance)
File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 59, in identify
pkg, build_type = get_package_with_build_type(str(desc.path))
File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 163, in get_package_with_build_type
pkg = _get_package(path)
File "/usr/lib/python3/dist-packages/colcon_ros/package_identification/ros.py", line 171, in _get_package
from catkin_pkg.package import has_ros_schema_reference
ImportError: cannot import name 'has_ros_schema_reference'
Summary: 0 packages finished [0.08s]
I've tried to purge and reinstall ALL packages relevant to ROS1, ROS2, colcon, catkin but that did not help.
In fact, having ROS2 uninstalled and trying to run colcon build
in the same workspace yields the same error.
The problem started to occur at some point couple days ago, before that I used this system for several months for both ROS1 and ROS2 development.
Any ideas what could have happen to it and is there a way to solve it before reinstalling the whole system?
Additional information:
└─▶ $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
Relevant environment variables:
└─▶ $ printenv | grep -i -e ROS -e CATKIN -e CMAKE -e RMW
LD_LIBRARY_PATH=/opt/ros/dashing/opt/yaml_cpp_vendor/lib:/opt/ros/dashing/opt/rviz_ogre_vendor/lib:/opt/ros/dashing/lib:/opt/rti.com/rti_connext_dds-5.3.1/lib/x64Linux3gcc5.4.0
AMENT_PREFIX_PATH=/opt/ros/dashing
ROS_VERSION=2
ROS_PYTHON_VERSION=3
PYTHONPATH=/opt/ros/dashing/lib/python3.6/site-packages
PATH=/opt/ros/dashing/bin:/opt/rti.com/rti_connext_dds-5.3.1/lib/x64Linux3gcc5.4.0:/opt/rti.com/rti_connext_dds-5.3.1/bin:/home/yossi/ardupilot/Tools/autotest:/opt/gcc-arm-none-eabi-4_9-2015q3/bin:/home/yossi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/yossi/.dotnet/tools
ROS_DISTRO=dashing
Could you share your versions of
colcon-ros
andcatkin-pkg-modules
?You need catkin_pkg(_modules) >= 0.4.14 for the has_ros_schema_reference function to exist
Please post the output of
dpkg -l | grep catkin-pkg
as well aspython3 -c "import catkin_pkg; print(catkin_pkg.__version__)"
.Unfortunately I had to reformat the computer and can't check anything anymore
@marguedas It was latest updated by
apt
@clyde That's the one option I haven't tried. Probably that could solve it...