Sure @bshah , here’s the output from each step.
Environment: SE3, Ubuntu 22.04
Command
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):
=== ./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
cd ~/ament_ws/src/stretch_ros2/stretch_funmap
uv venv --system-site-packages --allow-existing .venv
Output (No errors):
Using CPython 3.10.12 interpreter at: /usr/bin/python3.10
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
uv sync --frozen
Output (No error):
Installed 25 packages in 29ms
+ cma==4.0.0
+ contourpy==1.3.1
+ cycler==0.12.1
+ ...
+ transforms3d==0.4.2
Command
uv run cythonize stretch_funmap/cython_min_cost_path.pyx -3 -i
Output (Error):
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
cd ~/ament_ws
colcon build --symlink-install
Output (Build Error):
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:
- Cython Compilation Failure: Multiple top-level packages detected.
- 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
- 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!