question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: No module named catkin.environment_cache

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:18 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
lzyplayercommented, Jul 18, 2019

@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!

0reactions
Lycanthropeuscommented, Jun 8, 2020

Hello everyone, I am getting this same error, but I am using Windows. After reading the discussion above, I couldn’t figure out how to get rid of this error. I am a newbie at this, so could someone please help me with this issue?

–Using CATKIN_DEVEL_PREFIX: E:/trac_ik_git/trac_ik/trac_ik_csharp/build/devel – Using CMAKE_PREFIX_PATH: D:/Downloads/vcpkg-master/installed/x86-windows/debug;D:/Downloads/vcpkg-master/installed/x86-windows – Found PythonInterp: C:/Python27/python.exe (found version “2.7.18”) – Using PYTHON_EXECUTABLE: C:/Python27/python.exeFound PY_em: C:\Python27\lib\site-packages\em.pycUsing empy: C:/Python27/lib/site-packages/em.pyc`` – Using CATKIN_ENABLE_TESTING: ON – Call enable_testing() – Using CATKIN_TEST_RESULTS_DIR: E:/trac_ik_git/trac_ik/trac_ik_csharp/build/test_results – gtest not found, C++ tests can not be built. Please install the gtest headers globally in your system to enable gtests – nosetests not found, Python tests can not be run (try installing package ‘python-nose’) – catkin 0.7.24 – BUILD_SHARED_LIBS is on Traceback (most recent call last): File “E:/trac_ik_git/trac_ik/trac_ik_csharp/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/melodic/x64/share/catkin/cmake/safe_execute_process.cmake:11 (message): execute_process(C:/Python27/python.exe returned error code 1 Call Stack (most recent call first): C:/opt/ros/melodic/x64/share/catkin/cmake/all.cmake:208 (safe_execute_process) C:/opt/ros/melodic/x64/share/catkin/cmake/catkinConfig.cmake:20 (include) D:/Downloads/vcpkg-master/scripts/buildsystems/vcpkg.cmake:331 (_find_package) CMakeLists.txt:17 (find_package) CMakeLists.txt:17 (find_package)

– Configuring incomplete, errors occurred! See also “E:/trac_ik_git/trac_ik/trac_ik_csharp/build/CMakeFiles/CMakeOutput.log”.**

Read more comments on GitHub >

github_iconTop Results From Across the Web

ImportError: No module named catkin.environment_cache #806
We're getting an intermittent issue affecting our CI builds. It pops up at random on different packages, but always takes this form: ...
Read more >
ImportError: No module named catkin.environment_cache
I'm building on a MacBook Pro running Catalina 10.15.2. I'm following the OSX build instructions here: https://wiki.ros.org/melodic/Installa ...
Read more >
ROS kinetic: ImportError: No module named terminal_color
Hi, I a trying to compile a catkin package that shall generate some ROS messages. Unfortunately I get to this error an can't...
Read more >
[Fixed] ModuleNotFoundError: No module named 'cached ...
Quick Fix: Python raises the ImportError: No module named 'cached-property' when it cannot find the library cached-property . The most frequent source of ......
Read more >
Setting up ROS and running the beginner tutorials on Ubuntu ...
ImportError : "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg' Make sure that you have installed "catkin_pkg", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found