my CMakeLists.txt is like belows,


find_package(catkin REQUIRED COMPONENTS


During try to build code with ‘Cmake ..', following errors comes out

Traceback (most recent call last):
  File "D:.../build/catkin_generated/generate_cached_setup.py", line 20, in <module>
    from catkin.environment_cache import generate_environment_script
ImportError: No module named catkin.environment_cache
CMake Error at C:/opt/ros/noetic/x64/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  returned error code 1
Call Stack (most recent call first):
  C:/opt/ros/noetic/x64/share/catkin/cmake/all.cmake:208 (safe_execute_process)
  C:/opt/ros/noetic/x64/share/catkin/cmake/catkinConfig.cmake:21 (include)
  CMakeLists.txt:99 (find_package)
  • $\begingroup$ You are using Python 2.7 but Noetic only supports Python 3+. Did you follow these steps for your setup? Did you source ROS Noetic before executing any command? Did you verify that the catkin command is working (this invokes CMake)? $\endgroup$
    – Bi0T1N
    Nov 3 at 14:30
  • $\begingroup$ Hi, I just reinstalled ROS following the steps on Windows and remove Python2.7, roscore can work on ROS shorcut which created in step 6. How to source ROS Noetic ? I just copy C:/opt/ros/noetic/x64/setup.bat into ROS shortcut and press enter. For verifying the catkin command, I only can create folder in C drive, and catkin can work well。 $\endgroup$
    – Xiuyi Yang
    Nov 4 at 12:06
  • $\begingroup$ That what you did in step 6 is sourcing ROS, in other words the ROS commands incl. catkin can be used within this command window. You can move to any folder/disk and execute the ROS commands as long as you stay in this command window with the specific ROS environment setup through the setup.bat. $\endgroup$
    – Bi0T1N
    Nov 4 at 14:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.