Hey everyone,
I’ve been learning a lot about snaps recently, and I’ve really liked the idea especially for some of the multi-agent robotic systems I use. I’ve been trying to learn to make some snaps but I’ve been running into an issue for python dependencies for some of my packages.
My current packages requires tensorflow
and tensorflow-probability
to run, but I can’t seem to get them to work with my package on runtime. Every time I try and run it I get the following error:
[INFO] [worker_node-1]: process started with pid [99433]
[worker_node-1] Traceback (most recent call last):
[worker_node-1] File "/snap/mean-field/x1/lib/mean_field_worker/worker_node", line 6, in <module>
[worker_node-1] from pkg_resources import load_entry_point
[worker_node-1] File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
[worker_node-1] def _initialize_master_working_set():
[worker_node-1] File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
[worker_node-1] f(*args, **kwargs)
[worker_node-1] File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
[worker_node-1] working_set = WorkingSet._build_master()
[worker_node-1] File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
[worker_node-1] ws.require(__requires__)
[worker_node-1] File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
[worker_node-1] needed = self.resolve(parse_requirements(requirements))
[worker_node-1] File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve
[worker_node-1] raise DistributionNotFound(req, requirers)
[worker_node-1] pkg_resources.DistributionNotFound: The 'tensorflow' distribution was not found and is required by mean-field-worker
The following are my snapcraft.yaml
file and the package.xml
file for the python package:
name: multi-agent
version: '0.1'
summary: Test ROS2 snap for multi-agent model.
description: |
This example launches a ROS2 Worker.
base: core20
confinement: devmode
parts:
multi-agent-ros:
plugin: colcon
source: .
build-packages: [make, gcc, g++]
stage-packages: [ros-foxy-ros2launch, python3-numpy, python3-dev, libblas3, liblapack3, libopenblas-dev, liblapack-dev]
apps:
worker:
command: opt/ros/foxy/bin/ros2 launch multi_agent_worker worker.launch.py
plugs: [network, network-bind]
extensions: [ros2-foxy]
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/lapack"
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>multi_agent_worker</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="TODO@email.com">zmk5</maintainer>
<license>TODO: License declaration</license>
<exec_depend>rclpy</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>mean_field_msgs</exec_depend>
<exec_depend>python3-numpy</exec_depend>
<exec_depend>python3-pip</exec_depend>
<exec_depend>python-tensorflow-pip</exec_depend>
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>
<export>
<build_type>ament_python</build_type>
</export>
</package>
Any help would be greatly appreciated! Thank you!