Colcon not found after setup-ros
Closed this issue ยท 10 comments
Description
For some reason, the colcon
is not found after the setup-ros
action
Expected Behavior
colcon
is found and can be used to compile and run tests with`
Actual Behavior
I get the error: colcon: command not found
As seen in:
- https://github.com/LoyVanBeek/telegram_ros2/runs/532825694?check_suite_focus=true#step:4:2652
- https://github.com/LoyVanBeek/telegram_ros2/runs/537690031?check_suite_focus=true#step:6:6
To Reproduce
Nothing special, just the canonical, simplest use of setup-ros
, as used in eg. https://github.com/LoyVanBeek/telegram_ros2/actions/runs/64102949/workflow
System (please complete the following information)
- OS: Ubuntu 18.04 on GitHub Actions
- ROS 2 Distro: Eloquent
Additional context
I'm new to ROS2 and GitHub actions, just trying to learn.
Can you try this with the latest version of setup-ros
(0.0.15) and action-ros-ci
(0.0.14)
I've tried a few different versions, but in another commit I copied the workflow YAML from https://github.com/ros2/rosbag2/blob/master/.github/workflows/test.yml.
This does work for me, somehow.
The main difference is that I originally had a line '- uses: actions/checkout@v2`.
That change still doesn't make my build succeed but at least there is now Colcon to tell me that (package is not yet finished so some failures expected).
This may be an issue with the checkout
overwriting the directory for some reason. It's not 100% clear to me how these actions maintain state from one step to another (yet).
I will keep this open for tracking to see whether this is indeed a conflict between checkout
and the setup-ros
/action-ros-ci
actions.
Just bumping this thread to report the same thing on a small demo I'm doing too. The workflow ran without errors right before the commit where I added - uses:actions/checkout
to the workflow definition. Here's the log.
EDIT:
I went through the console output for the step in ros-tooling/setup-ros
where colcon
is installed using pip
, and the warning of interest is: WARNING: The script colcon is installed in '/usr/lib/example_package' which is not on PATH.
Similarly, pip
itself is also installed in /usr/lib/example_package
, and not in /usr/local/lib/python3.8/dist-packages
(check this section in the workflow log).
I don't know what the fix here is, but it looks like PATH
gets altered in some way between actions/checkout
and ros-tooling/setup-ros
PATH
remains consistent, I verified. There must be some other problem here. I will report back with any more information I come across.
Update (07/11):
The problem still persists as long as actions/checkout
is allowed to checkout the repository in ${{ GITHUB_WORKSPACE }}
. If actions/checkout
is provided with a checkout location of ${{ GITHUB_WORKSPACE }}/ros_ws/src
, pip
is not installed in /usr/lib/example_package
. I still don't understand why pip
gets installed there, but I think this information may be useful to whoever wants to investigate this matter further.
Update (07/16):
After a little more digging, I can confirm that this problem is exclusive to Python packages that define the install-scripts
location in a setup.cfg
file. So, all (?) ROS-based Python packages. A stop-gap could be to move to /
before invoking pip
and then returning with cd -
? @piraka9011
Try this -
sudo apt install python3-colcon-common-extensions
Going to close this as stale - if it remains a problem please reopen.
Came across this issue when setting up a ROS2 python package.
As explained in #408, it seems that this only happens in python packages with a setup.cfg
, as deleting the file made CI pass.
#408 remains a draft. @aprotyas Any plans on continuing the work? Or should someone else continue the work?
Should reopen this one, thanks. @emersonknapp
The problem still persists as long as actions/checkout is allowed to checkout the repository in ${{ GITHUB_WORKSPACE }}. If actions/checkout is provided with a checkout location of ${{ GITHUB_WORKSPACE }}/ros_ws/src, pip is not installed in /usr/lib/example_package. I still don't understand why pip gets installed there, but I think this information may be useful to whoever wants to investigate this matter further.
A work around for this issue could be to update the instructions in action-ros-ci's README to specify a path
when using actions/checkout, such as:
- uses: actions/checkout@v2
with:
path: tmp
such that the setup.cfg
gets placed into the ${{ GITHUB_WORKSPACE }}/tmp
rather than ${{ GITHUB_WORKSPACE }}
.
action-ros-ci's vcs-repo-file-url
can then be updated with something like below:
- uses: ros-tooling/action-ros-ci@v0.2
with:
target-ros2-distro: rolling
vcs-repo-file-url: tmp/deps.repos
Given that:
- we need to be able to get
.repos
files from the repo itself, somehow - we would prefer not to need extra inputs for
actions/checkout
- so no
path: tmp
- so no
- some workflows probably use
vcs-repo-file-url: "${{ github.workspace }}/path/to/file.repos"
(I know thesetup-ros
tests do) - making the given
vcs-repo-file-url
path relative to thevcs import
ed repo (instead of the one checked out usingactions/checkout
) and not relying on users usingactions/checkout
is not optimal, since people might want to generate a.repos
file beforeaction-ros-ci
is run
..a solution like #408, where we run pip install ...
in a different directory, is probably best. It sounds like #408 doesn't work, but I tried doing it slightly differently and it seems to work: #466. If other people could confirm that it works for their workflows, that would be great!
This should now be fixed with ros-tooling/setup-ros@v0.2
, @0.2.2
, or @master
.