Issue Installing MATLAB Engine API for Python in Python 3.8 Environment

7 views (last 30 days)
Hello,
I'm trying to install the MATLAB Engine API for Python on my windows (64) machine, but I've encountered an error during the installation process. I'm using MATLAB R2022a, tried Python 3.8/3.7/3.7.
The error message I'm receiving is: "setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'R2022a'"
I would greatly appreciate any advice or recommendations you can offer on this issue. Here are the steps I've followed so far:
  1. Activated conda python environment (in pycharm)
  2. Navigated to the MATLAB Engine API directory (D:\matlab\install\extern\engines\python).
  3. Ran python setup.py install to install the MATLAB Engine API.
  4. I also attempted to modify the code in setup.py "version="R2022a" as "version="0.2022a", still get the same error.
Please let me know if there's any other information I can provide to assist in troubleshooting this issue.
Thank you in advance for your help!

Answers (1)

Yoga
Yoga on 2 Aug 2023
The issue seems to occur when you try to install the python package generated from MATLAB in Anaconda based virtual environments. The generated package works completely fine inside virtual environments created through methods other than conda like "pip". It is not guaranteed that the library compiler generated code will install fine inside Conda based virtual environments.
However, it is recommended to use the "py" command instead of the "python" command inside the Conda virtual environment terminal to make it work if you have some Python installation other than Anaconda in the computer.
"py" command:
py setup.py install
The "py" command python launcher which is a utility that comes with Python installations on Windows. It gets installed into "C:\Windows\" so it’s available without requiring path modifications.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!