Clear Filters
Clear Filters

rosinit failed in Matlab 2022a, MacOS Apple Silicon

15 views (last 30 days)
pyenv get
ans =
PythonEnvironment - 属性:
Version: "3.9"
Executable: "/opt/homebrew/Caskroom/miniforge/base/envs/matlab_ros/bin/python"
Library: "/opt/homebrew/Caskroom/miniforge/base/envs/matlab_ros/lib/libpython3.9.dylib"
Home: "/opt/homebrew/Caskroom/miniforge/base/envs/matlab_ros"
Status: NotLoaded
ExecutionMode: InProcess
and rosinit get
Launching ROS Core...
Adding required Python packages to virtual environment..Done.
Could not install the required Python packages. System error message: Looking in links:
/Applications/MATLAB_R2022a.app/sys/ros1/share/python
Processing /Applications/MATLAB_R2022a.app/sys/ros1/share/python/catkin_pkg-0.4.23-py3-none-any.whl
Processing /Applications/MATLAB_R2022a.app/sys/ros1/share/python/empy-3.3.4.tar.gz
Processing
/Applications/MATLAB_R2022a.app/sys/ros1/share/python/docutils-0.17.1-py2.py3-none-any.whl
Processing
/Applications/MATLAB_R2022a.app/sys/ros1/share/python/pyparsing-2.4.7-py2.py3-none-any.whl
Processing
/Applications/MATLAB_R2022a.app/sys/ros1/share/python/python_dateutil-2.8.1-py2.py3-none-any.whl
[31mERROR: Could not find a version that satisfies the requirement pyyaml (from versions: none)[0m
[31mERROR: No matching distribution found for pyyaml[0m
. Use pyenv function to set the path to the Python executable and retry the command.
/opt/homebrew/Caskroom/miniforge/base/envs/matlab_ros/bin/python -m pip install pyyaml and /opt/homebrew/Caskroom/miniforge/base/envs/matlab_ros/bin/python -m pip install pyyaml==5.4.1 make no sense.
  6 Comments
Cam Salzberger
Cam Salzberger on 24 Mar 2022
Hmm, I've not seen this exact issue before. One thing that has helped other similar issues is to upgrade pip and setuptools in the base Python installation. So in a terminal outside of MATLAB run:
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade setuptools
After doing that, you can force recreation of the virtual environment in MATLAB by running this from the Command Window. Make sure pyenv is set the same way first (to the base executable).
ros.internal.createOrGetLocalPython(true)
-Cam
Sheng Yang
Sheng Yang on 25 Mar 2022
Edited: Sheng Yang on 25 Mar 2022
Thank you for the patient response. Unfortunately, nothing changed.
In system terminal:
~ python3 -m pip install --upgrade pip
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: pip in /opt/homebrew/lib/python3.9/site-packages (22.0.4)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
~ python3 -m pip install --upgrade setuptools
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: setuptools in /opt/homebrew/lib/python3.9/site-packages (61.0.0)
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
In matlab:
>> pyenv
ans =
PythonEnvironment - 属性:
Version: "3.9"
Executable: "/opt/homebrew/opt/python@3.9/bin/python3.9"
Library: "/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib"
Home: "/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9"
Status: NotLoaded
ExecutionMode: InProcess
>> ros.internal.createOrGetLocalPython(true)
Removing previous version of Python virtual environment..Done.
Creating a Python virtual environment...Done.
Adding required Python packages to virtual environment...Done.
错误使用 ros.internal.createOrGetLocalPython
Could not install the required Python packages. System error message: Looking in links:
/Applications/MATLAB_R2022a.app/sys/ros1/share/python
Processing /Applications/MATLAB_R2022a.app/sys/ros1/share/python/catkin_pkg-0.4.23-py3-none-any.whl
Processing /Applications/MATLAB_R2022a.app/sys/ros1/share/python/empy-3.3.4.tar.gz
Processing /Applications/MATLAB_R2022a.app/sys/ros1/share/python/docutils-0.17.1-py2.py3-none-any.whl
Processing /Applications/MATLAB_R2022a.app/sys/ros1/share/python/pyparsing-2.4.7-py2.py3-none-any.whl
Processing
/Applications/MATLAB_R2022a.app/sys/ros1/share/python/python_dateutil-2.8.1-py2.py3-none-any.whl
[31mERROR: Could not find a version that satisfies the requirement pyyaml (from versions: none)[0m
[31mERROR: No matching distribution found for pyyaml[0m
. Use pyenv function to set the path to the Python executable and retry the command.
So strange!

Sign in to comment.

Accepted Answer

Sheng Yang
Sheng Yang on 25 Mar 2022
Edited: Sheng Yang on 25 Mar 2022
I did some surveys on createOrGetLocalPython.m and wheels in /Applications/MATLAB_R2022a.app/sys/ros1/share/python and found this problem is associated with apple silicon. In /Applications/MATLAB_R2022a.app/sys/ros1/share/python, there are three PyYAML wheels:
PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl
PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl
PyYAML-5.4.1-cp39-cp39-win_amd64.whl
None of them is suitable for macos (apple silicon). (`~/.matlab/R2022a/ros1/maci64/venv/bin/python` is the venv created by ros.internal.createOrGetLocalPython)
python ~/.matlab/R2022a/ros1/maci64/venv/bin/python -m pip install PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl
ERROR: PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl is not a supported wheel on this platform.
However, you can install PyYAML==5.4.1 by pip directly. The current solution for this problem (only in apple silicon) should be:
Step 1, execute these commands in matlab (you will get error infomation, ignore them)
pyenv('Version', '/opt/homebrew/bin/python3')
ros.internal.createOrGetLocalPython(true)
Step 2, execute the command in system terminal
~/.matlab/R2022a/ros1/maci64/venv/bin/python -m pip install pyyaml==5.4.1
Step 3, execute these commands in matlab
ros.internal.createOrGetLocalPython()
rosinit
@Cam Salzberger Thank you for your patient replies. Maybe an update is necessary for Matlab 2022a?
  4 Comments
Karthik Reddy Vennapureddy
Hi Yang,
Could you let us know whether the python in '/opt/homebrew/opt/python@3.9/bin/python3.9' is arm64 or x86_64 version. To know which architecture of python you are using, execute the following command:
!file /opt/homebrew/opt/python@3.9/bin/python3.9
The error seems to be occurring with the native python (arm64). You could install a intel or universal python as alternative from the official python 3.9.10 release for macos: https://www.python.org/downloads/macos/.
- Karthik Reddy
Sheng Yang
Sheng Yang on 4 Apr 2022
Indeed, it is the native python installed by the homebrew:
/opt/homebrew/opt/python@3.9/bin/python3.9: Mach-O 64-bit executable arm64

Sign in to comment.

More Answers (1)

Kenneth Hoffmann
Kenneth Hoffmann on 3 Aug 2022
Hi! Is MATLAB ROS stable on Mac Silicon? I am considering upgrading. Thanks!
  1 Comment
Sk Shaon
Sk Shaon on 10 Feb 2023
No, Still has the same Issue
Unable to install the required Python packages. System error message:
Looking in links: c:\Program Files\MATLAB\R2022b\sys\ros1\share\python
Processing c:\program files\matlab\r2022b\sys\ros1\share\python\catkin_pkg-0.4.23-py3-none-any.whl
Processing c:\program files\matlab\r2022b\sys\ros1\share\python\empy-3.3.4.tar.gz
Processing c:\program files\matlab\r2022b\sys\ros1\share\python\docutils-0.17.1-py2.py3-none-any.whl
Processing c:\program files\matlab\r2022b\sys\ros1\share\python\pyparsing-2.4.7-py2.py3-none-any.whl
Processing c:\program files\matlab\r2022b\sys\ros1\share\python\python_dateutil-2.8.1-py2.py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement pyyaml (from versions: none)
ERROR: No matching distribution found for pyyaml
.
Use ROS Toolbox preferences to create a Python virtual environment.

Sign in to comment.

Tags

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!