I installed ROS 2 Jazzy on macOS using the idesign0/ros2 Homebrew tap:
brew install idesign0/ros2/ros2-jazzy
The formula builds and installs successfully, but the generated ros2 executable and the Python C extensions appear to be hardcoded to a Python Framework installation that no longer exists on the system.
I am using a Mamba environment with Python 3.11:
/Users/amoralesma/conda/envs/p311/bin/python3
Environment
- macOS
- Homebrew
- ROS 2 Jazzy
idesign0/ros2/ros2-jazzy
- Version:
26.07.31.106
- Python: 3.11
- Environment manager: Mamba
Relevant Python installations:
/Users/amoralesma/conda/envs/p311/bin/python3
/opt/homebrew/bin/python3
/usr/bin/python3
Homebrew Python 3.11 is available at:
/opt/homebrew/opt/python@3.11
Initial error
After installation, executing ros2 resulted in:
zsh: /opt/homebrew/opt/ros2-jazzy/bin/ros2: bad interpreter: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3: no such file or directory
The generated executable had the following shebang:
head -n 1 /opt/homebrew/opt/ros2-jazzy/bin/ros2
which pointed to:
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3
That Python installation does not exist on the machine.
I temporarily changed the ros2 shebang to use the Python 3.11 interpreter from the Mamba environment:
/Users/amoralesma/conda/envs/p311/bin/python3
The ros2 command then starts, but importing rclpy fails because the compiled ROS libraries themselves were built against the missing Python Framework.
The complete error is:
Traceback (most recent call last):
File "/opt/homebrew/opt/ros2-jazzy/bin/ros2", line 34, in <module>
sys.exit(load_entry_point('ros2cli==0.32.11', 'console_scripts', 'ros2')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/opt/ros2-jazzy/bin/ros2", line 26, in importlib_load_entry_point
return next(matches).load()
^^^^^^^^^^^^^^^^^^^^
File "/Users/amoralesma/conda/envs/p311/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/amoralesma/conda/envs/p311/lib/python3.11/importlib/__init__.py", line 1176, in _find_and_load
return _bootstrap._find_and_load(name, import_)
File "/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/ros2cli/cli.py", line 22, in <module>
from rclpy.executors import ExternalShutdownException
File "/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rclpy/__init__.py", line 49, in <module>
from rclpy.signals import install_signal_handlers
File "/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rclpy/signals.py", line 15, in <module>
from rclpy.exceptions import InvalidHandle
File "/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rclpy/exceptions.py", line 16, in <module>
from rclpy.impl.implementation_singleton import rclpy_implementation as _rclpy
File "/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rclpy/impl/implementation_singleton.py", line 32, in <module>
rclpy_implementation = import_c_library('._rclpy_pybind11', package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rpyutils/import_c_library.py", line 39, in import_c_library
return importlib.import_module(name, package=package)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: dlopen(
/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rclpy/_rclpy_pybind11.cpython-311-darwin.so,
0x0002
): Library not loaded:
/Library/Frameworks/Python.framework/Versions/3.11/Python
Referenced from:
/opt/homebrew/Cellar/ros2-jazzy/26.07.31.106/lib/liblifecycle_msgs__rosidl_generator_py.dylib
Reason:
tried:
'/Library/Frameworks/Python.framework/Versions/3.11/Python'
'/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/Python.framework/Versions/3.11/Python'
'/Library/Frameworks/Python.framework/Versions/3.11/Python'
The C extension:
/opt/homebrew/opt/ros2-jazzy/lib/python3.11/site-packages/rclpy/_rclpy_pybind11.cpython-311-darwin.so
failed to be imported while being present on the system.
Expected behavior
I would expect the Homebrew package to either:
- Use the Python interpreter provided by the active Homebrew Python installation, or
- Provide a clear/official way to configure the Python interpreter used by the ROS 2 Python bindings.
In particular, I would expect the generated rclpy libraries to link against a Python installation that is actually present on the system.
Actual behavior
The ROS 2 Python executables and compiled libraries reference:
/Library/Frameworks/Python.framework/Versions/3.11/
even though that Python installation is not present.
Changing the ros2 shebang to point to another Python does not resolve the issue because the compiled .dylib files still reference the missing Python Framework.
I installed ROS 2 Jazzy on macOS using the
idesign0/ros2Homebrew tap:The formula builds and installs successfully, but the generated
ros2executable and the Python C extensions appear to be hardcoded to a Python Framework installation that no longer exists on the system.I am using a Mamba environment with Python 3.11:
Environment
idesign0/ros2/ros2-jazzy26.07.31.106Relevant Python installations:
Homebrew Python 3.11 is available at:
Initial error
After installation, executing
ros2resulted in:The generated executable had the following shebang:
which pointed to:
That Python installation does not exist on the machine.
I temporarily changed the
ros2shebang to use the Python 3.11 interpreter from the Mamba environment:The
ros2command then starts, but importingrclpyfails because the compiled ROS libraries themselves were built against the missing Python Framework.The complete error is:
Expected behavior
I would expect the Homebrew package to either:
In particular, I would expect the generated
rclpylibraries to link against a Python installation that is actually present on the system.Actual behavior
The ROS 2 Python executables and compiled libraries reference:
even though that Python installation is not present.
Changing the
ros2shebang to point to another Python does not resolve the issue because the compiled.dylibfiles still reference the missing Python Framework.