# Help Needed: Build Error with stretch\_funmap Due to Numpy Dependency

**URL:** <https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191>\
**Category:** Ask\
**Created:** [January 3, 2025, 6:27pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191 "2025-01-03T18:27:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![allen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/allen/32/914_2.png) [@allen](https://forum.hello-robot.com/u/allen)\
**Post date:** [January 3, 2025, 6:27pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/1 "2025-01-03T18:27:50Z")

</div>

Hi everyone,

I’m encountering a build error while setting up the Hello Robot workspace. Here’s what I did:

1. Cloned the repository:

```auto
cd ~
git clone https://github.com/hello-robot/stretch_install
cd stretch_install
git pull

```

1. Ran the update script:

```auto
./stretch_update_ros_workspace.sh

```

During the process of installing `stretch_web_interface`’s dependencies, `numpy==1.24.4` gets installed, which leads to the following error:

```auto
  from numpy.distutils.mingw32ccompiler import generate_manifest
  File "/home/hello-robot/.local/lib/python3.10/site-packages/numpy/distutils/mingw32ccompiler.py", line 28, in <module>
    from distutils.msvccompiler import get_build_version as get_build_msvc_version
ModuleNotFoundError: No module named 'distutils.msvccompiler'
---
Failed <<< stretch_funmap [29.1s, exited with code 1]

```

### Issue Details:

It seems that the problem stems from `numpy==1.24.4`, which introduces some dependency issues with `distutils.msvccompiler`.

However, when I upgrade numpy==2.1.4, the build error disappeared.

Has anyone else faced a similar issue?

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [February 3, 2025, 6:57pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/2 "2025-02-03T18:57:34Z")

</div>

Hi @allen, the fix for this build issue was merged on Friday. [Details on the fix here](https://forum.hello-robot.com/t/software-drop-january-31-2025/1216#p-3091-run-funmap-within-a-uv-python-virtual-environment-3). To resolve the issue, you can first follow the [instructions here](https://docs.hello-robot.com/0.3/installation/ros_workspace/#uv-not-found-failure) to get uv, and then follow the [normal instructions](https://docs.hello-robot.com/0.3/installation/ros_workspace/#how) to update your ROS workspace. This should resolve the build issue you’re seeing.

---

<div class="post-metadata">

**Author:** ![allen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/allen/32/914_2.png) [@allen](https://forum.hello-robot.com/u/allen)\
**Post date:** [February 5, 2025, 6:10pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/3 "2025-02-05T18:10:13Z")

</div>

Hi @bshah , thanks for getting back to me on this issue. However, after installing uv, and follow the normal instructions to update my ROS workspace, it still failed to complete the update.

Here’s the breakdown of the issue: I’m running into an issue while following the workspace update instructions for Stretch ROS2. The problem occurs when executing the script:

```auto
./stretch_install/factory/22.04/stretch_create_ament_workspace.sh

```

Specifically, the error happens at this line:

```auto
uv run cythonize stretch_funmap/cython_min_cost_path.pyx -3 -i

```

### **Error Description**

When the script reaches the Cythonization step, I get the following error:

```auto
error: Multiple top-level packages discovered in a flat-layout: ['rviz', 'launch', 'images', 'resource', 'tmpte6sgat5', 'stretch_funmap'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.

```

### **Steps to Reproduce**

Follow the workspace update instructions for Stretch ROS2.

### **Additional Context**

I was able to dig in and found out the issue is happening in `pyproject.toml` file. There’s seems to be conflicts between `pyproject.toml` and `setup.py` within stretch\_funmap package.

Thanks in advance for your help! I really appreciate it!

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [February 6, 2025, 8:00pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/4 "2025-02-06T20:00:04Z")

</div>

Hey @allen, thanks for the details regarding this error. I’m not able to reproduce it, so let’s take it step-by-step and see if we can uncover more details.

Can you run each step below, one at a time, and collect the output (any errors) of each step:

```auto
rm -rf ~/ament_ws
mkdir -p ~/ament_ws/src
cd ~/ament_ws/src
vcs import --input ~/stretch_install/factory/22.04/stretch_ros2_humble.repos
cd ~/ament_ws/src/stretch_ros2/stretch_funmap
uv venv --system-site-packages --allow-existing .venv
uv sync --frozen
uv run cythonize stretch_funmap/cython_min_cost_path.pyx -3 -i
cd ~/ament_ws
colcon build --symlink-install

```

---

<div class="post-metadata">

**Author:** ![allen](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/allen/32/914_2.png) [@allen](https://forum.hello-robot.com/u/allen)\
**Post date:** [February 7, 2025, 2:31am UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/5 "2025-02-07T02:31:50Z")

</div>

Sure @bshah , here’s the output from each step.

### Environment: SE3, Ubuntu 22.04

* * *

### Command

```bash
rm -rf ~/ament_ws
mkdir -p ~/ament_ws/src
cd ~/ament_ws/src
vcs import --input ~/stretch_install/factory/22.04/stretch_ros2_humble.repos

```

### Output (No errors):

```auto
=== ./audio_common (git) ===
Cloning into '.'...
=== ./realsense-ros (git) ===
Cloning into '.'...
Note: switching to '4.55.1'.
...
HEAD is now at 8a86cb88 4.55.1
=== ./sllidar_ros2 (git) ===
Cloning into '.'...
Note: switching to '34300099fadfc772965962dec837bf436706188f'.
...
HEAD is now at 3430009 bugfix:set the minimum distance to 5cm
...

```

* * *

### Command

```bash
cd ~/ament_ws/src/stretch_ros2/stretch_funmap
uv venv --system-site-packages --allow-existing .venv

```

### Output (No errors):

```auto
Using CPython 3.10.12 interpreter at: /usr/bin/python3.10
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate

```

* * *

```bash
uv sync --frozen

```

### Output (No error):

```auto
Installed 25 packages in 29ms
 + cma==4.0.0
 + contourpy==1.3.1
 + cycler==0.12.1
 + ...
 + transforms3d==0.4.2

```

* * *

### Command

```bash
uv run cythonize stretch_funmap/cython_min_cost_path.pyx -3 -i

```

### Output (Error):

```auto
Compiling /home/hello-robot/ament_ws/src/stretch_ros2/stretch_funmap/stretch_funmap/cython_min_cost_path.pyx because it changed.
[1/1] Cythonizing /home/hello-robot/ament_ws/src/stretch_ros2/stretch_funmap/stretch_funmap/cython_min_cost_path.pyx
error: Multiple top-level packages discovered in a flat-layout: ['rviz', 'launch', 'images', 'resource', 'tmpugwgwciy', 'stretch_funmap'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.

```

_Fails due to multiple top-level packages being detected._

* * *

### Command

```bash
cd ~/ament_ws
colcon build --symlink-install

```

### Output (Build Error):

```auto
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 268, in run_setup
    exec(code, g)
  File "<string>", line 6, in <module>
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/ __init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 160, in setup
    dist.parse_config_files()
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/dist.py", line 652, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 73, in apply_configuration
    return _apply(dist, config, filepath)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 54, in apply
    _apply_project_table(dist, config, root_dir)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 81, in _apply_project_table
    corresp(dist, value, root_dir)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/setuptools/config/_apply_pyprojecttoml.py", line 193, in _license
    _set_config(dist, "license", _static.Str(val["text"]))
KeyError: 'text'
--- stderr: stretch_funmap                   
Traceback (most recent call last):
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_core/executor/ __init__.py", line 91, in __call__
    rc = await self.task(*args, **kwargs)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_core/task/ __init__.py", line 93, in __call__
    return await task_method(*args, **kwargs)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_ros/task/ament_python/build.py", line 51, in build
    setup_py_data = get_setup_data(self.context.pkg, env)
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_core/task/python/ __init__.py", line 20, in get_setup_data
    return dict(pkg.metadata[key](env))
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_ros/package_augmentation/ros_ament_python.py", line 57, in getter
    return get_setup_information(
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 249, in get_setup_information
    _setup_information_cache[hashable_env] = _get_setup_information(
  File "/home/hello-robot/.local/lib/python3.10/site-packages/colcon_python_setup_py/package_identification/python_setup_py.py", line 296, in _get_setup_information
    result = subprocess.run(
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist. __dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata. __dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1.
---
Failed <<< stretch_funmap [0.20s, exited with code 1]

Summary: 0 packages finished [0.34s]
  1 package failed: stretch_funmap
  1 package had stderr output: stretch_funmap
Command '['/usr/bin/python3', '-c', 'import sys;from contextlib import suppress;exec("with suppress(ImportError): from setuptools.extern.packaging.specifiers import SpecifierSet");exec("with suppress(ImportError): from packaging.specifiers import SpecifierSet");from distutils.core import run_setup;dist = run_setup( \'setup.py\', script_args=(\'--dry-run\',), stop_after=\'config\');skip_keys = (\'cmdclass\', \'distclass\', \'ext_modules\', \'metadata\');data = { key: value for key, value in dist. __dict__.items() if ( not key.startswith(\'_\') and not callable(value) and key not in skip_keys and key not in dist.display_option_names )};data[\'metadata\'] = { k: v for k, v in dist.metadata. __dict__.items() if k not in (\'license_files\', \'provides_extras\')};sys.stdout.buffer.write(repr(data).encode(\'utf-8\'))']' returned non-zero exit status 1.

```

* * *

## Summary of Issues:

1. **Cython Compilation Failure** : Multiple top-level packages detected.
2. **Build Failure in `stretch_funmap`** :
  - `setup.py` metadata issues (`license`, `authors`, `scripts` outside `pyproject.toml`).

## Approaches I Tried

- Reinstalling UV
- Edit pyproject.toml based on reference [here](https://stackoverflow.com/questions/72294299/multiple-top-level-packages-discovered-in-a-flat-layout)
- Upgrade pip and setup tools

* * *

Thanks again in advance for your help!

## Update

I was able to resolved the cythonize and build error by uninstalling setuptools & numpy: `pip uninstall setuptools numpy`, and downgrading em: `pip install 'empy<4.0'` to the system default version. Turns out the python package comflicts is the main reason the error persists and also the reason that you are not able to reproduce the error.  
After testing both cythonize step and stretch\_funmap is build successfully, I was able to run the update ros2 workspace code without any failures, thanks again for your help!

---

<div class="post-metadata">

**Author:** ![bshah](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/bshah/32/55_2.png) [@bshah](https://forum.hello-robot.com/u/bshah)\
**Post date:** [February 11, 2025, 9:29pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/6 "2025-02-11T21:29:40Z")

</div>

Thanks @allen, I’ve just pushed [some](https://github.com/hello-robot/stretch_ros2/commit/260aa8e1f5317caeef69a1455464d9e3051880a1) [fixes](https://github.com/hello-robot/stretch_install/commit/7d7280710ea5f9cb592822949d74f4e0ba6aae6b). Go ahead and try updating the ROS workspace again.

---

<div class="post-metadata">

**Author:** ![lstegner](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/lstegner/32/90_2.png) [@lstegner](https://forum.hello-robot.com/u/lstegner)\
**Post date:** [February 20, 2025, 8:24pm UTC](https://forum.hello-robot.com/t/help-needed-build-error-with-stretch-funmap-due-to-numpy-dependency/1191/7 "2025-02-20T20:24:29Z")

</div>

The update worked now, thanks!!
