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 samba共享慢的原因及解决方案

《Linuxsamba共享慢的原因及解决方案》:本文主要介绍Linuxsamba共享慢的原因及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux samba共享慢原因及解决问题表现原因解决办法总结Linandroidux samba共享慢原因及解决

Tomcat版本与Java版本的关系及说明

《Tomcat版本与Java版本的关系及说明》:本文主要介绍Tomcat版本与Java版本的关系及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Tomcat版本与Java版本的关系Tomcat历史版本对应的Java版本Tomcat支持哪些版本的pythonJ

SpringBoot启动报错的11个高频问题排查与解决终极指南

《SpringBoot启动报错的11个高频问题排查与解决终极指南》这篇文章主要为大家详细介绍了SpringBoot启动报错的11个高频问题的排查与解决,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一... 目录1. 依赖冲突:NoSuchMethodError 的终极解法2. Bean注入失败:No qu

找不到Anaconda prompt终端的原因分析及解决方案

《找不到Anacondaprompt终端的原因分析及解决方案》因为anaconda还没有初始化,在安装anaconda的过程中,有一行是否要添加anaconda到菜单目录中,由于没有勾选,导致没有菜... 目录问题原因问http://www.chinasem.cn题解决安装了 Anaconda 却找不到 An

Spring定时任务只执行一次的原因分析与解决方案

《Spring定时任务只执行一次的原因分析与解决方案》在使用Spring的@Scheduled定时任务时,你是否遇到过任务只执行一次,后续不再触发的情况?这种情况可能由多种原因导致,如未启用调度、线程... 目录1. 问题背景2. Spring定时任务的基本用法3. 为什么定时任务只执行一次?3.1 未启用

springboot报错Invalid bound statement (not found)的解决

《springboot报错Invalidboundstatement(notfound)的解决》本文主要介绍了springboot报错Invalidboundstatement(not... 目录一. 问题描述二.解决问题三. 添加配置项 四.其他的解决方案4.1 Mapper 接口与 XML 文件不匹配

MySQL新增字段后Java实体未更新的潜在问题与解决方案

《MySQL新增字段后Java实体未更新的潜在问题与解决方案》在Java+MySQL的开发中,我们通常使用ORM框架来映射数据库表与Java对象,但有时候,数据库表结构变更(如新增字段)后,开发人员可... 目录引言1. 问题背景:数据库与 Java 实体不同步1.1 常见场景1.2 示例代码2. 不同操作

IDEA中Git版本回退的两种实现方案

《IDEA中Git版本回退的两种实现方案》作为开发者,代码版本回退是日常高频操作,IntelliJIDEA集成了强大的Git工具链,但面对reset和revert两种核心回退方案,许多开发者仍存在选择... 目录一、版本回退前置知识二、Reset方案:整体改写历史1、IDEA图形化操作(推荐)1.1、查看提

java常见报错及解决方案总结

《java常见报错及解决方案总结》:本文主要介绍Java编程中常见错误类型及示例,包括语法错误、空指针异常、数组下标越界、类型转换异常、文件未找到异常、除以零异常、非法线程操作异常、方法未定义异常... 目录1. 语法错误 (Syntax Errors)示例 1:解决方案:2. 空指针异常 (NullPoi

SpringBoot项目启动报错"找不到或无法加载主类"的解决方法

《SpringBoot项目启动报错找不到或无法加载主类的解决方法》在使用IntelliJIDEA开发基于SpringBoot框架的Java程序时,可能会出现找不到或无法加载主类com.example.... 目录一、问题描述二、排查过程三、解决方案一、问题描述在使用 IntelliJ IDEA 开发基于