Edit on Github


Enable Multicast

In order to communicate successfully via DDS, the used network interface has to be multicast enabled. We’ve seen in past experiences that this might not necessarily be enabled by default (on Ubuntu or OSX) when using the loopback adapter. See the original issue or a conversation on ros-answers. You can verify that your current setup allows multicast with the ROS 2 tool:

In Terminal 1:

ros2 multicast receive

In Terminal 2:

ros2 multicast send

If the first command did not return a response similar to:

Received from xx.xxx.xxx.xx:43751: 'Hello World!'

then you will need to update your firewall configuration to allow multicast using ufw.

sudo ufw allow in proto udp to
sudo ufw allow in proto udp from

You can check if the multicast flag is enabled for your network interface using the ifconfig tool and looking for MULITCAST in the flags section:

eno1: flags=4163<...,MULTICAST>

Import failing even with library present on the system

Sometimes rclpy fails to be imported because of some missing DLLs on your system. If so make sure to install all the dependencies listed in the “Installing prerequisites” sections of the installation instructions (Windows, MacOS).

If you are installing from binaries, you may need to update your dependencies: they must be the same version as those used to build the binaries.

If you are still having issues, you can use the Dependencies tool to determine which dependencies are missing on your system. Use the tool to load the corresponding .pyd file, and it should report unavailable DLL modules. Be sure that the current workspace is sourced before you execute the tool, otherwise there will be unresolved ROS DLL files. Use this information to install additional dependencies or adjust your path as necessary.