Ask Your Question
0

Source install on Fedora 31. Error with catkin.environment

asked 2019-11-11 16:41:11 -0600

Maya gravatar image

updated 2019-11-11 18:05:42 -0600

Hello all,

I'm trying to install ROS on Fedora 31 from source and I have that error:

Traceback (most recent call last):
  File "/home/malcolm/ros_catkin_ws/melodic/src_melodic/build_isolated/rosbag_migration_rule/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 /home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/usr/bin/python2
  "/home/malcolm/ros_catkin_ws/melodic/src_melodic/build_isolated/rosbag_migration_rule/catkin_generated/generate_cached_setup.py")
  returned error code 1
Call Stack (most recent call first):
  /home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated/share/catkin/cmake/all.cmake:208 (safe_execute_process)
  /home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/malcolm/ros_catkin_ws/melodic/src_melodic/build_isolated/rosbag_migration_rule/CMakeFiles/CMakeOutput.log".
<== Failed to process package 'rosbag_migration_rule':

I've tried reinstalling everything and I have python2/3-catkin_pkg installed.

Most error I found online talk doing catkin clean and re-compiling but I can't really do that during a source install.

Here the generated catkin file for rosbag_migration_rule

# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os
import stat
import sys

# find the import for catkin's python package - either from source space or from an installed underlay
if os.path.exists(os.path.join('/home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated/share/catkin/cmake', 'catkinConfig.cmake.in')):
    sys.path.insert(0, os.path.join('/home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated/share/catkin/cmake', '..', 'python'))
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 "/home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated".split(';'):
        python_path = os.path.join(workspace, 'lib/python2.7/site-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

code = generate_environment_script('/home/malcolm/ros_catkin_ws/melodic/src_melodic/devel_isolated/rosbag_migration_rule/env.sh')

output_filename = '/home/malcolm/ros_catkin_ws/melodic/src_melodic/build_isolated/rosbag_migration_rule/catkin_generated/setup_cached.sh'
with open(output_filename, 'w') as f:
    #print('Generate script for cached setup "%s"' % output_filename)
    f.write('\n'.join(code))

mode = os.stat(output_filename).st_mode
os.chmod(output_filename, mode | stat.S_IXUSR)

and here is the catkin cmake folder

cd /home/malcolm/ros_catkin_ws/melodic/src_melodic/install_isolated/share/catkin/cmake
[malcolm@localhost cmake]$ ls
all.cmake                          catkin_python_setup.cmake      list_insert_in_workspace_order.cmake
assert.cmake                       catkin_symlink_install.cmake   order_paths.py
atomic_configure_file.cmake        catkin_workspace.cmake         parse_package_xml.py
catkin_add_env_hooks.cmake         custom_install.cmake           platform
catkinConfig.cmake                 debug_message.cmake            python.cmake
catkinConfig-version.cmake         em                             safe_execute_process.cmake
catkin_destinations.cmake          em_expand.cmake                shell.cmake
catkin_download.cmake              empy.cmake                     stamp.cmake
catkin_generate_environment.cmake  env-hooks                      string_starts_with.cmake
catkin_install_python.cmake        find_program_required.cmake    symlink_install
catkin_libraries.cmake             interrogate_setup_dot_py.py    templates
catkin_metapackage.cmake           legacy.cmake                   test
catkin_package.cmake               list_append_deduplicate.cmake  tools
catkin_package_xml.cmake           list_append_unique.cmake       toplevel.cmake

Not sure where to go from there.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-11-11 19:03:59 -0600

Maya gravatar image

Found the solution. It's necessary to force catkin to compile everything against python3

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-11-11 16:41:11 -0600

Seen: 14 times

Last updated: Nov 11