ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

FileNotFoundError: [Errno 2] No such file or directory: 'make'

asked 2021-08-20 13:45:39 -0500

130s gravatar image

updated 2022-07-18 10:15:59 -0500

Issue

catkin build fails on ros:noetic-ros-base.

$ docker pull ros:noetic-ros-base
noetic-ros-base: Pulling from library/ros
Digest: sha256:66ba20ba51d44779dff11f490b0f30ab04f8ca15935f32ea5f058f1ac011d84d
:
root@07979acfa2c3:/cws# history
 1  DIR=/cws && mkdir -p $DIR/src && apt update && apt install -y python3-catkin-tools
 7  cd $DIR && catkin init && catkin config --install
 9  source /opt/ros/noetic/setup.bash       
# catkin build
Traceback (most recent call last):
  File "/usr/bin/catkin", line 33, in <module>
    sys.exit(load_entry_point('catkin-tools==0.7.1', 'console_scripts', 'catkin')())
  File "/usr/lib/python3/dist-packages/catkin_tools/commands/catkin.py", line 266, in main
    catkin_main(sysargs)
  File "/usr/lib/python3/dist-packages/catkin_tools/commands/catkin.py", line 261, in catkin_main
    sys.exit(args.main(args) or 0)
  File "/usr/lib/python3/dist-packages/catkin_tools/verbs/catkin_build/cli.py", line 273, in main
    make_args, makeflags, cli_flags, jobserver = configure_make_args(
  File "/usr/lib/python3/dist-packages/catkin_tools/argument_parsing.py", line 359, in configure_make_args
    job_server.initialize(
  File "/usr/lib/python3/dist-packages/catkin_tools/execution/job_server.py", line 305, in initialize
    JobServer._gnu_make = GnuMake()
  File "/usr/lib/python3/dist-packages/catkin_tools/execution/job_server.py", line 115, in __init__
    if test_gnu_make_support():
  File "/usr/lib/python3/dist-packages/catkin_tools/execution/job_server.py", line 110, in test_gnu_make_support
    return test_gnu_make_support_common(JOBSERVER_SUPPORT_MAKEFILE)
  File "/usr/lib/python3/dist-packages/catkin_tools/execution/job_server.py", line 83, in test_gnu_make_support_common
    ret = subprocess.call(['make', '-f', makefile, '-j2'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'make'

catkin_makealso fails, but a different error, which looks similar to what's reported in https://answers.ros.org/question/384705

root@609b91fd3266:/cws# rm -fr .catkin_tools/                     
root@609b91fd3266:/cws# catkin_make                                                                                                                            
Base path: /cws                                        
Source space: /cws/src                                            
Build space: /cws/build                                   
Devel space: /cws/devel                                
Install space: /cws/install                               
Creating symlink "/cws/src/CMakeLists.txt" pointing to "/opt/ros/noetic/share/catkin/cmake/toplevel.cmake"
####                                                                                                                                                           
#### Running command: "cmake /cws/src -DCATKIN_DEVEL_PREFIX=/cws/devel -DCMAKE_INSTALL_PREFIX=/cws/install -G Unix Makefiles" in "/cws/build"
####                                                              
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!               
See also "/cws/build/CMakeFiles/CMakeOutput.log".   
Invoking "cmake" failed
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2021-08-20 13:48:19 -0500

130s gravatar image

updated 2021-08-20 14:15:08 -0500

Looks like similar / the same background as https://answers.ros.org/question/384705.

In my case, the issue went away after either:

  • switching the Docker image to ros:noetic-ros-core.
  • installing build-essential.
edit flag offensive delete link more
-1

answered 2022-07-18 02:01:23 -0500

When you open a file with the name “filename.ext”; you are telling the open() function that your file is in the current working directory . This is called a relative path.

file = open('filename.ext') //relative path

In the above code, you are not giving the full path to a file to the open() function, just its name - a relative path. The error “FileNotFoundError: [Errno 2] No such file or directory” is telling you that there is no file of that name in the working directory. So, try using the exact, or absolute path.

file = open(r'C:\path\to\your\filename.ext') //absolute path

In the above code, all of the information needed to locate the file is contained in the path string - absolute path.

If the user does not pass the full path to the file (on Unix type systems this means a path that starts with a slash), the python file path is interpreted relatively to the current working directory. The current working directory usually is the directory in which you started the program. In order to make this work, the directory containing the python executable must be in the PATH, a so-called environment variable that contains directories that are automatically used for searching executables when you enter a command. In any case, if your Python script file and your data input file are not in the same directory, you always have to specify either a relative path between them or you have to use an absolute path for one of them.

edit flag offensive delete link more

Comments

I don't know if this answer is relevant to OP. Besides that, entire sentences look like copy-paste of http://net-informations.com/python/er...

130s gravatar image 130s  ( 2022-07-18 10:20:03 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-08-20 13:45:39 -0500

Seen: 1,967 times

Last updated: Jul 18 '22