Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'catkin_pkg' when building ROS2 package using ros-action-ci@v0.3 #826

Open
hugols16 opened this issue Jun 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@hugols16
Copy link

hugols16 commented Jun 5, 2023

Description

** clear and concise description of the bug is **

When using ros-action-ci@v0.3 and ROS2/humble distro, ament_cmake_core attempts to import the catkin_pkg module, but it can't be found. Sourcing of the setup file seems to be successful, and

bash -c,source /opt/ros/humble/setup.sh && colcon build --symlink-install --packages-up-to app --event-handlers=console_cohesion+
  /usr/bin/bash -c source /opt/ros/humble/setup.sh && colcon build --symlink-install --packages-up-to app --event-handlers=console_cohesion+
  Starting >>> app
  --- output: app
  -- The C compiler identification is GNU 11.3.0
  -- The CXX compiler identification is GNU 11.3.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Found ament_cmake: 1.3.4 (/opt/ros/humble/share/ament_cmake/cmake)
  -- Found Python3: /opt/hostedtoolcache/Python/3.10.6/x64/bin/python3.10 (found version "3.10.6") found components: Interpreter 
  -- Override CMake install command with custom implementation using symlinks instead of copying resources
  -- Found rclpy: 3.3.8 (/opt/ros/humble/share/rclpy/cmake)
  -- Found ament_cmake_lint_cmake: 0.12.6 (/opt/ros/humble/share/ament_cmake_lint_cmake/cmake)
  -- Found ament_cmake_pep257: 0.12.6 (/opt/ros/humble/share/ament_cmake_pep257/cmake)
  -- Found ament_cmake_xmllint: 0.12.6 (/opt/ros/humble/share/ament_cmake_xmllint/cmake)
  -- Found ament_cmake_flake8: 0.12.6 (/opt/ros/humble/share/ament_cmake_flake8/cmake)
  Traceback (most recent call last):
    File "/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 22, in <module>
      from catkin_pkg.package import parse_package_string
  ModuleNotFoundError: No module named 'catkin_pkg'
  CMake Error at /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
    execute_process(/opt/hostedtoolcache/Python/3.10.6/x64/bin/python3.10
    /opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
    /home/runner/work/rc/rc/ros_ws/src/1oggin8qo3v/rc/src/app/package.xml
    /home/runner/work/rc/rc/ros_ws/build/app/ament_cmake_core/package.cmake)
    returned error code 1
  Call Stack (most recent call first):
    /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
    /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package.cmake:63 (ament_package_xml)
    CMakeLists.txt:48 (ament_package)
  
  
  -- Configuring incomplete, errors occurred!
  ---
  --- stderr: app
  Traceback (most recent call last):
    File "/opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 22, in <module>
      from catkin_pkg.package import parse_package_string
  ModuleNotFoundError: No module named 'catkin_pkg'
  CMake Error at /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
    execute_process(/opt/hostedtoolcache/Python/3.10.6/x64/bin/python3.10
    /opt/ros/humble/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
    /home/runner/work/rc/rc/ros_ws/src/1oggin8qo3v/rc/src/app/package.xml
    /home/runner/work/rc/rc/ros_ws/build/app/ament_cmake_core/package.cmake)
    returned error code 1
  Call Stack (most recent call first):
    /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
    /opt/ros/humble/share/ament_cmake_core/cmake/core/ament_package.cmake:63 (ament_package_xml)
    CMakeLists.txt:48 (ament_package)

Github Workflow

---
name: tests_v2

on:  # yamllint disable-line rule:truthy
  pull_request:
  push:
    branches:
      - develop
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}  # yamllint disable-line rule:line-length
  cancel-in-progress: true

jobs:
  tests:
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
      - name: Check out the repository
        uses: actions/checkout@v3
      - name: Setup python
        uses: actions/setup-python@v4
        with:
          python-version: 3.10.6

      # Cache the installation of Poetry itself, e.g. the next step.
      # This prevents the workflow from installing Poetry every time, which
      # can be slow. Note the use of the Poetry version number in the cache
      # key, and the "-0" suffix: this allows you to invalidate the cache
      # manually if/when you want to upgrade Poetry, or if something goes wrong.
      - name: cache poetry install
        uses: actions/cache@v3
        with:
          path: ~/.local
          key: poetry-1.3.2-0

      # Install Poetry. You could do this manually, or there are several
      # actions that do this. `snok/install-poetry` seems to be minimal yet
      # complete, and really just calls out to Poetry's default install script,
      # which feels correct. We pin the Poetry version here because Poetry does
      # occasionally change APIs between versions and we don't want our
      # actions to break if it does.
      - name: Install poetry
        uses: snok/install-poetry@v1
        with:
          version: 1.3.2

      # Install dependencies. `--no-root` means "install all dependencies but
      # not the project itself", which is what you want to avoid caching
      # _your_ code. The `if` statement ensures this only runs on a cache miss.
      - name: Install dependencies
        run: poetry install --no-interaction --no-root
        if: steps.cache-deps.outputs.cache-hit != 'true'

      - name: Install the project
        run: poetry install --no-interaction
      - name: Setup ROS
        uses: ros-tooling/setup-ros@v0.6
        with:
          required-ros-distributions: humble
      - name: Run workspace tests
        uses: ros-tooling/action-ros-ci@v0.3
        with:
          import-token: ${{ secrets.GITHUB_TOKEN }}
          package-name: app
          target-ros2-distro: humble
          colcon-defaults: |
            {
              "build": {
                "mixin": ["coverage-gcc", "coverage-pytest"]
              },
              "test": {
                "mixin": ["coverage-pytest"]
              }
            }

Expected Behavior

Workspace tests should run without failure.

Actual Behavior

Workspace tests do not run.

To Reproduce

Github workflow is shown above.

System (please complete the following information)

  • OS: Ubuntu 22.04
  • ROS 2 Distro: Humble

Additional context

  • Tried with virtualenv enabled and disabled for poetry -> DID NOT WORK
  • Tried installing catkin directly, both through apt and pip -> DID NOT WORK
  • Tried sourcing /opt/ros/humble/setup.bash directly -> DID NOT WORK
@hugols16 hugols16 added the bug Something isn't working label Jun 5, 2023
@christophebedard
Copy link
Member

christophebedard commented Jul 20, 2023

What is poetry used for in your project?

I'm wondering if it works if you remove poetry and don't manually install Python.

@christophebedard
Copy link
Member

Also, this is kind of similar to ros-tooling/setup-ros#552, although that one is on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants