Ubuntu20.04 [Ros Noetic]版本——在catkin_make编译时出现报错的解决方案

2024-04-29 12:04

本文主要是介绍Ubuntu20.04 [Ros Noetic]版本——在catkin_make编译时出现报错的解决方案,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

今天在新的笔记本电脑上进行catkin_make的编译过程中遇到了报错,这个报错在之前也遇到过,但是,我却忘了怎么解决。很是头痛!

经过多篇博客的查询,特此解决了这个编译报错的问题,于此特地记录!!!

整体报错信息如下:

Base path: /home/hjx/hjx_file/URDF_model/catkin_ws
Source space: /home/hjx/hjx_file/URDF_model/catkin_ws/src
Build space: /home/hjx/hjx_file/URDF_model/catkin_ws/build
Devel space: /home/hjx/hjx_file/URDF_model/catkin_ws/devel
Install space: /home/hjx/hjx_file/URDF_model/catkin_ws/install
####
#### Running command: "cmake /home/hjx/hjx_file/URDF_model/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/hjx/hjx_file/URDF_model/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/hjx/hjx_file/URDF_model/catkin_ws/install -G Unix Makefiles" in "/home/hjx/hjx_file/URDF_model/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/hjx/hjx_file/URDF_model/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/noetic
-- This workspace overlays: /opt/ros/noetic
-- Found PythonInterp: /home/hjx/anaconda3/bin/python3 (found suitable version "3.11.7", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: /home/hjx/anaconda3/bin/python3
-- Using Debian Python package layout
-- Using empy: /home/hjx/anaconda3/lib/python3.11/site-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/hjx/hjx_file/URDF_model/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /home/hjx/anaconda3/bin/python3 (found version "3.11.7") 
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.10
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on/opt/ros/noetic/share/catkin/cmake/em/order_packages.cmake.em:2:1: error: RuntimeError: ImportError: "from catkin_pkg.topological_order import topological_order" failed: cannot import name 'Sequence' from 'collections' (/home/hjx/anaconda3/lib/python3.11/collections/__init__.py)
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
<root>:1:1: from this context
Traceback (most recent call last):File "<string>", line 8, in <module>File "/home/hjx/anaconda3/lib/python3.11/site-packages/catkin_pkg/topological_order.py", line 39, in <module>from .packages import find_packagesFile "/home/hjx/anaconda3/lib/python3.11/site-packages/catkin_pkg/packages.py", line 38, in <module>from .package import _get_package_xmlFile "/home/hjx/anaconda3/lib/python3.11/site-packages/catkin_pkg/package.py", line 44, in <module>from catkin_pkg.condition import evaluate_conditionFile "/home/hjx/anaconda3/lib/python3.11/site-packages/catkin_pkg/condition.py", line 17, in <module>import pyparsing as ppFile "/home/hjx/anaconda3/lib/python3.11/site-packages/pyparsing/__init__.py", line 140, in <module>from .core import __diag__, __compat__File "/home/hjx/anaconda3/lib/python3.11/site-packages/pyparsing/core.py", line 31, in <module>from pathlib import PathFile "/home/hjx/anaconda3/lib/python3.11/site-packages/pathlib.py", line 10, in <module>from collections import Sequence
ImportError: cannot import name 'Sequence' from 'collections' (/home/hjx/anaconda3/lib/python3.11/collections/__init__.py)During handling of the above exception, another exception occurred:Traceback (most recent call last):File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 6323, in <module>if __name__ == '__main__': main()^^^^^^File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 6320, in mainexitCode = invoke(sys.argv[1:], executable=sys.argv[0], errors=None)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 6280, in invokeinterp.go(File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4724, in goself.protect(name, method, file)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4740, in protectcallable(*args, **kwargs)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4758, in fileself.fileChunks(file, config.buffering, locals, dispatcher)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4804, in fileChunkswhile not self.safe(scanner, done, locals, dispatcher):^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4862, in safeif dispatcher():^^^^^^^^^^^^File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 5800, in dispatchself.handle((type, error, traceback), fatal)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4843, in safereturn self.parse(scanner, locals)^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4874, in parseself.run(token, locals)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 5115, in runtoken.run(self, locals)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 2571, in runinterp.execute(self.code, locals)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 5178, in executeself.core.execute(statements, self.globals, locals)File "/home/hjx/anaconda3/lib/python3.11/site-packages/em.py", line 4228, in executeexecFunc(code, globals)File "<string>", line 10, in <module>
RuntimeError: ImportError: "from catkin_pkg.topological_order import topological_order" failed: cannot import name 'Sequence' from 'collections' (/home/hjx/anaconda3/lib/python3.11/collections/__init__.py)
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):execute_process(/home/hjx/hjx_file/URDF_model/catkin_ws/build/catkin_generated/env_cached.sh"/home/hjx/anaconda3/bin/python3""/home/hjx/anaconda3/lib/python3.11/site-packages/em.py" "--raw-errors""-F""/home/hjx/hjx_file/URDF_model/catkin_ws/build/catkin_generated/order_packages.py""-o""/home/hjx/hjx_file/URDF_model/catkin_ws/build/catkin_generated/order_packages.cmake""/opt/ros/noetic/share/catkin/cmake/em/order_packages.cmake.em") returnederror code 1
Call Stack (most recent call first):/opt/ros/noetic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)/opt/ros/noetic/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand)CMakeLists.txt:69 (catkin_workspace)-- Configuring incomplete, errors occurred!
See also "/home/hjx/hjx_file/URDF_model/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/hjx/hjx_file/URDF_model/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

关于报错界面的部分截图:

关于我在执行catkin_make是遇到的报错关键信息如下:

RuntimeError: ImportError: "from catkin_pkg.topological_order import topological_order" failed: cannot import name 'Sequence' from 'collections' (/home/hjx/anaconda3/lib/python3.11/collections/__init__.py)
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):execute_process(/home/hjx/hjx_file/URDF_model/catkin_ws/build/catkin_generated/env_cached.sh"/home/hjx/anaconda3/bin/python3""/home/hjx/anaconda3/lib/python3.11/site-packages/em.py" "--raw-errors""-F""/home/hjx/hjx_file/URDF_model/catkin_ws/build/catkin_generated/order_packages.py""-o""/home/hjx/hjx_file/URDF_model/catkin_ws/build/catkin_generated/order_packages.cmake""/opt/ros/noetic/share/catkin/cmake/em/order_packages.cmake.em") returnederror code 1
Call Stack (most recent call first):/opt/ros/noetic/share/catkin/cmake/em_expand.cmake:25 (safe_execute_process)/opt/ros/noetic/share/catkin/cmake/catkin_workspace.cmake:35 (em_expand)CMakeLists.txt:69 (catkin_workspace)-- Configuring incomplete, errors occurred!
See also "/home/hjx/hjx_file/URDF_model/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/hjx/hjx_file/URDF_model/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

其实,关键的报错点如下:

CMake Error at /opt/ros/noetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):

根据这个报错提示,我找到了几篇相关的博客:

Ubuntu20.04安装Ros Noetic版本,在catkin_make编译时出现的问题_could not find py_em (missing: py_em)-CSDN博客

Ubuntu 20.04 ROS noetic 问题解决_cmake error at /opt/ros/noetic/share/catkin/cmake/-CSDN博客

 根据上面这2篇博客其实就可以解决问题了

下面为给出解决这个报错的终端指令:

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

 便可完成工作空间的创建!

下图是我catkin_make成功的页面截图:

 后面再次进行catkin_make编译时就不会再出现报错了

这篇关于Ubuntu20.04 [Ros Noetic]版本——在catkin_make编译时出现报错的解决方案的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/946033

相关文章

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

数据库oracle用户密码过期查询及解决方案

《数据库oracle用户密码过期查询及解决方案》:本文主要介绍如何处理ORACLE数据库用户密码过期和修改密码期限的问题,包括创建用户、赋予权限、修改密码、解锁用户和设置密码期限,文中通过代码介绍... 目录前言一、创建用户、赋予权限、修改密码、解锁用户和设置期限二、查询用户密码期限和过期后的修改1.查询用

IDEA如何切换数据库版本mysql5或mysql8

《IDEA如何切换数据库版本mysql5或mysql8》本文介绍了如何将IntelliJIDEA从MySQL5切换到MySQL8的详细步骤,包括下载MySQL8、安装、配置、停止旧服务、启动新服务以及... 目录问题描述解决方案第一步第二步第三步第四步第五步总结问题描述最近想开发一个新应用,想使用mysq

java脚本使用不同版本jdk的说明介绍

《java脚本使用不同版本jdk的说明介绍》本文介绍了在Java中执行JavaScript脚本的几种方式,包括使用ScriptEngine、Nashorn和GraalVM,ScriptEngine适用... 目录Java脚本使用不同版本jdk的说明1.使用ScriptEngine执行javascript2.

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas

深入理解Redis大key的危害及解决方案

《深入理解Redis大key的危害及解决方案》本文主要介绍了深入理解Redis大key的危害及解决方案,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着... 目录一、背景二、什么是大key三、大key评价标准四、大key 产生的原因与场景五、大key影响与危

Debian如何查看系统版本? 7种轻松查看Debian版本信息的实用方法

《Debian如何查看系统版本?7种轻松查看Debian版本信息的实用方法》Debian是一个广泛使用的Linux发行版,用户有时需要查看其版本信息以进行系统管理、故障排除或兼容性检查,在Debia... 作为最受欢迎的 linux 发行版之一,Debian 的版本信息在日常使用和系统维护中起着至关重要的作

Golan中 new() 、 make() 和简短声明符的区别和使用

《Golan中new()、make()和简短声明符的区别和使用》Go语言中的new()、make()和简短声明符的区别和使用,new()用于分配内存并返回指针,make()用于初始化切片、映射... 详细介绍golang的new() 、 make() 和简短声明符的区别和使用。文章目录 `new()`

Xshell远程连接失败以及解决方案

《Xshell远程连接失败以及解决方案》本文介绍了在Windows11家庭版和CentOS系统中解决Xshell无法连接远程服务器问题的步骤,在Windows11家庭版中,需要通过设置添加SSH功能并... 目录一.问题描述二.原因分析及解决办法2.1添加ssh功能2.2 在Windows中开启ssh服务2

VMWare报错“指定的文件不是虚拟磁盘“或“The file specified is not a virtual disk”问题

《VMWare报错“指定的文件不是虚拟磁盘“或“Thefilespecifiedisnotavirtualdisk”问题》文章描述了如何修复VMware虚拟机中出现的“指定的文件不是虚拟... 目录VMWare报错“指定的文件不是虚拟磁盘“或“The file specified is not a virt