ImportError: No module named catkin
generate_cached_setup.py
:
try:
from catkin.environment_cache import generate_environment_script
except ImportError:
# search for catkin package in all workspaces and prepend to path
for workspace in ''.split(';'):
python_path = os.path.join(workspace, 'lib/python3/dist-packages')
if os.path.isdir(os.path.join(python_path, 'catkin')):
sys.path.insert(0, python_path)
break
from catkin.environment_cache import generate_environment_script
The issue is the ''.split()
. What is missing here is a list of paths separated by semicolons. Which path list? CMAKE_PREFIX_PATH
!
So, in case your vscode cmake extension doesn't configure your ros projects, make sure the CMAKE_PREFIX_PATH
includes ROS. Also make sure the semicolon is escaped (only once, if you do it in the vscode gui, twice if in json):
"cmake.configureEnvironment": {
"CMAKE_PREFIX_PATH": "/home/user/code/devel\\;/opt/ros/noetic"
}