E_Long_Must
E_Long_Must

Reputation: 21

ROS2 Humble Installation Environment Setup Issue - ros2: command not found

I am using Untuntu 22.04 in WSL trying to install ROS2 Humble.

After following the tutorial in ROS2 website, I am stuck with the step

source /opt/ros/humble/setup.bash

I have installed ROS2 but am unable to run it with the command ros2 even after I have sourced setup.bash.

I have double checked I am using Bash shell.

Found no solutions on the internet.

My last resort was ChatGPT, it said "ros2 executable is not present in the /opt/ros/humble/bin directory"

Anyone know what's the issue and how to solve it.

Greatly appreciated!

Upvotes: 0

Views: 2473

Answers (3)

serkan
serkan

Reputation: 146

First possibility is that you may not have installed it in the right place. Please check if there is such a directory /opt/ros/humble.

ls /opt/ros/humble

If your output is like this No such file or directory, it means you did not install it correctly.

It may be installed in another location on the computer, so search the system with this command sudo find / -name humble. If you do not get any output, it means that the installation has not been done.

Follow this page again

Upvotes: 0

kwon
kwon

Reputation: 1

I think that Ros2 isn't installed in your PC. You need to check the directory

  1. open This PC and find Ubuntu22.04
  2. open the directory which is /opt/ros/humble
  3. If is setup.bash inexist, you should reinstall ROS

Upvotes: 0

E_Long_Must
E_Long_Must

Reputation: 21

Guys I used the source installation https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html instead of binary and successful. It should be ~/ros2_humble/install/local_setup.bash instead when setting up the environment.

But if you open a new terminal and run ros2 you will still get ros2 command not found. You will have to do the following:

  1. Open shell configuration file: nano ~/.bashrc, it opens a text editor
  2. Add this line at the end of the line: source /<path to ros2>/install/setup.bash
  3. Save the changes with Ctrl+O and press Enter
  4. After saving the changes, either open a new terminal window or run the following command to apply the changes to your current terminal session: source ~/.bashrc
  5. Close terminal and re-open again, try ros2 again

Let me know if the above works for you or I have any mistakes.

Hope it helps!

Upvotes: 0

Related Questions