'E: Unable to locate package ros-foxy-desktop' intalling ROS2 in windows 10(wsl2)

Viewed 1070

I installing ROS2 in the windows computer. I am using WSL2, Ubuntu 20.04.LTS

sudo apt install ros-foxy-desktop -y

But the results is

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package ros-foxy-desktop

How can I fix this problem?

1 Answers

You need to add the right sources such that apt can find that package. here - https://docs.ros.org/en/foxy/Installation/Alternatives/Ubuntu-Install-Binary.html - you can see that you need to run at least two steps before installing foxy.

sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key  -o /usr/share/keyrings/ros-archive-keyring.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

Note: These steps work fine on ubuntu 22.04. Not sure about 20.04.

Related