catkin_tools: ImportError: No module named catkin.environment_cache

System Info

  • Operating System: Ubuntu Trusty
  • Version of catkin_tools: 0.4.2-1
  • ROS Distro: Indigo-ish, catkin 0.6.18

Build / Run Issue

I have a large build which runs via Jenkins inside a cowbuilder environment. I periodically have this build fail with an error which looks like the following:

00:10:36.448 _______________________________________________________________________________
00:10:36.448 Errors << controller_manager_msgs:cmake /tmp/buildd/workspace/debian/tmp/build/logs-sdk/controller_manager_msgs/build.cmake.000.log
00:10:36.448 Traceback (most recent call last):
00:10:36.448   File "/tmp/buildd/workspace/debian/tmp/build/build-sdk/controller_manager_msgs/catkin_generated/generate_cached_setup.py", line 20, in <module>
00:10:36.448     from catkin.environment_cache import generate_environment_script
00:10:36.448 ImportError: No module named catkin.environment_cache
00:10:36.448 CMake Error at /tmp/buildd/workspace/debian/tmp/opt/clearpath/2.0pre/sdk/share/catkin/cmake/safe_execute_process.cmake:11 (message):
00:10:36.448   execute_process(/usr/bin/python
00:10:36.448   "/tmp/buildd/workspace/debian/tmp/build/build-sdk/controller_manager_msgs/catkin_generated/generate_cached_setup.py")
00:10:36.448   returned error code 1
00:10:36.448 Call Stack (most recent call first):
00:10:36.448   /tmp/buildd/workspace/debian/tmp/opt/clearpath/2.0pre/sdk/share/catkin/cmake/all.cmake:186 (safe_execute_process)
00:10:36.448   /tmp/buildd/workspace/debian/tmp/opt/clearpath/2.0pre/sdk/share/catkin/cmake/catkinConfig.cmake:20 (include)
00:10:36.448   CMakeLists.txt:5 (find_package)
00:10:36.448 
00:10:36.448 

The package which triggers the issue is arbitrary— it seems to simply happen whenever, on various different packages. It looks like some kind of a race condition, but it’s unclear to me whether the root cause is in catkin_tools or catkin itself.

I don’t believe I ever saw this with 0.3.x, but we also switched to 0.4.x pretty early on.

I’m not using eatmydata, so all writes to disk should be fully synced, but it’s certainly possible this is coming from an interaction between catkin and the cowbuilder’s copy-on-write fs overlay.

I don’t have concrete steps to reproduce, but please let me know if there are ways I could instrument my build to supply more meaningful diagnostic information.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (15 by maintainers)

Most upvoted comments

@130s I have the same issues when using Clion and just solve it. But I don’t think our problem is the same with the one they mentioned.

/home/*******/APPlication/clion-2019.1.4/bin/cmake/linux/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCATKIN_DEVEL_PREFIX:PATH=/home/vickylzy/WorkSPacesROS/catkin_ws/devel -G "CodeBlocks - Unix Makefiles" /home/vickylzy/WorkSPacesROS/catkin_ws/src
-- Using CATKIN_DEVEL_PREFIX: /home/vickylzy/WorkSPacesROS/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/vickylzy/WorkSPacesROS/catkin_ws/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.18
-- BUILD_SHARED_LIBS is on
Traceback (most recent call last):
  File "/home/*******/WorkSPacesROS/catkin_ws/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 /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/usr/bin/python
  "/home/*******/WorkSPacesROS/catkin_ws/build/catkin_generated/generate_cached_setup.py")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/all.cmake:207 (safe_execute_process)
  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/*******/WorkSPacesROS/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/*******/WorkSPacesROS/catkin_ws/build/CMakeFiles/CMakeError.log".

[Failed to reload]

  • Problem:
    • I have source /opt/ros/kinetic/setup.bash line added in my ~/.bashrc. Thus it won’t be the problem. However I have also added /home/USERNAME/catkin_ws/devel/setup.bash(I know it’s not recommended) after former line. And when i start clion byPATH_TO_CLION/clion.sh cmake went wrong and show just the same error ImportError: No module named catkin.environment_cachein clion–cmake bar
  • solution:
    • comment out line /home/USERNAME/catkin_ws/devel/setup.bash in ~/.bashrc and start over , problem gone

Thanks for any advice on why this problem occur!