I’ve been reading all information I have found about this issue an a this point I’m kinda lost. I’m toying with snapcraft as part of some technology scouting. As an exercise I’m trying to snap a ROS application which has some dependencies on pip packages and other libraries.
I’m using core as a base (the application is based on ros kinetic) and since xenial has entered EOL that meant that I had to change to an older snapcraft version in order to be able to use such base (porting from kinectic to some other version is out of the question at this moment).
Luckily…
snap install snapcraft --channel 4.x
Did the trick. After this I tried to build the snap using a quite simple snapcraft.yaml
name: my-awesome-robot-snap
base: core
version: '0.1'
summary: A snap containing a ros app
description: |
This is my-snap's description.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
parts:
robot-workspace:
plugin: catkin
source: .
apps:
system:
command: roslaunch robot-app main.launch
plugs: [network, network-bind]
daemon: simple
Unfortunately when I try to create the snap I get the aforementioned error.
Initializing rosdep database...
Updating rosdep database...
Warning: running 'rosdep update' as root is not recommended.
You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
Determining system dependencies for Catkin packages...
ERROR: no rosdep rule for 'python-dbus'
Package 'python-dbus' isn't a valid system dependency. Did you forget to add it to catkin-packages? If not, add the Ubuntu package containing it to stage-packages until you can get it into the rosdep database.
Here is the first thing I find puzzling. The project has several python and non python dependencies. If I try to run again snapcraft, the error will re-appear but mention a different library even if I make no changes to the snapcraft.yaml. Sometimes it will always complain about the same X times in a row. But looks like the “source” library that triggers the error is random.
After googling a little found some similar errors being discussed but all of them referred to a missing functionality on the catkin plugin for pip that was fixed in catkin plugin: support rosdep pip dependencies by kyrofa · Pull Request #1581 · canonical/snapcraft · GitHub
I’ve checked the PR and it should be inside of 4.8 according to github.
Anyway, I went on and tried some of the alternatives I found in old threads:
- putting apt based libraries inside build-packages:
- create a pip-pkg part and add the python libraries there
- force different build orders (pip-pkg before robot-workspace)
But nothing worked.
Next thing I tried was to check if rosdep, can actually resolve a couple of the failing dependencies. I fired a docker image based on xenial+kinetic and run
❯ rosdep resolve python-dbus --rosdistro kinetic
#apt
python-dbus
❯ rosdep resolve python-boto3-pip --rosdistro kinetic
#pip
boto3
Seeing that this was somewhat possible, I kept digging and realize that you can access the snapcraft VM right after the error with the --debug flag. Here comes my second puzzling moment, I tried the same and…
Initializing rosdep database...
Updating rosdep database...
Warning: running 'rosdep update' as root is not recommended.
You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
Determining system dependencies for Catkin packages...
ERROR: no rosdep rule for 'python-dbus'
Package 'python-dbus' isn't a valid system dependency. Did you forget to add it to catkin-packages? If not, add the Ubuntu package containing it to stage-packages until you can get it into the rosdep database.
snapcraft-my-awesome-robot-snap # rosdep resolve python-dbus --rosdistro kinetic
bash: rosdep: command not found
Anybody could explain me why is not rosdep available in the VM?
Anyway, thinking that it might be something that the catkin-plugin is using, and then disposing of, I tried to manually install rosdep within the VM
snapcraft-my-awesome-robot-snap # apt-cache search rosdep
Yielded python-rosdep as available. I installed it, went to /root/project, and then…
snapcraft-my-awesome-robot-snap ../project# sudo rosdep init
snapcraft-my-awesome-robot-snap ../project# rosdep update
snapcraft-my-awesome-robot-snap ../project# rosdep resolve python-dbus --rosdistro kinetic
WARNING: ROS_PYTHON_VERSION is unset. Defaulting to 2
ERROR: no rosdep rule for 'python-dbus'
snapcraft-my-awesome-baktus-snap ../project# rosdep resolve python-boto3-pip --rosdistro kinetic
WARNING: ROS_PYTHON_VERSION is unset. Defaulting to 2
ERROR: no rosdep rule for 'python-boto3-pip'
So it looks like there is definitely something fishy. At this point I’m out of ideas about how to fix this. Any suggestions will be really appreciated. Thanks in advance!