Updating ROS with cpython compile error due to Numpy

Hello, I am trying to update my ros workspace following this Updating your ROS Workspace - Stretch Docs . My Ubuntu is 22.04 LTS, and ROS is humble.

After running the ./stretch_update_ros_workspace.sh for a while, the updating terminated with the following message:

INFO: compile options: '-I/home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/.venv/include -I/usr/include/python3.10 -c'
INFO: x86_64-linux-gnu-gcc: /home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/stretch_funmap/cython_min_cost_path.c

/home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/stretch_funmap/cython_min_cost_path.c:1257:10: fatal error: numpy/arrayobject.h: No such file or directory
1257 | #include "numpy/arrayobject.h"
     |          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

error: Command "x86_64-linux-gnu-gcc \
 -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall \
 -g -fstack-protector-strong -Wformat -Werror=format-security \
 -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security \
 -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC \
 -I/home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/.venv/include \
 -I/usr/include/python3.10 \
 -c /home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/stretch_funmap/cython_min_cost_path.c \
 -o /home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/tmpvxr9zwz1/home/hcal/ament_ws/src/stretch_ros2/stretch_funmap/stretch_funmap/cython_min_cost_path.o" failed with exit status 1

I am using the latest file from GitHub - hello-robot/stretch_install: Install scripts for the Stretch mobile manipulators from Hello Robot Inc. · GitHub. Can anyone check this problem?

Thank you so much!

Hey @Tom_Tan, thanks for your post!

Could you please share your pip list | grep numpy?

Also, if you run pip install -U numpy and rebuild, does it complete the build?

Best,
Shehab

1 Like
pip list | grep numpy
numpy                                  2.2.6
numpy-stl                              3.2.0

This is my result.

At the beginning of the build, the shell displays "Downgrade to numpy 1.26.4…
". To my understanding, numpy version of system python should be 1.26.4. Is it right?

Ah, if that is the case, please do pip install numpy==1.26.4!

Also, are you running this on a robot, or an Ubuntu machine that is not a robot? Thanks for clarifying!

I am running this on a robot to update stretch_ros

Here is a followup. I have successfully updated the ros by following this Cythonize command fails to find numpy/arrayobject.h · Issue #92 · hello-robot/stretch_install · GitHub

1 Like

Thank you for the link! I’m glad you were able to resolve it!

1 Like