Issue Installing MATLAB Engine API for Python in Python 3.8 Environment
10 views (last 30 days)
Show older comments
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:
- Activated conda python environment (in pycharm)
- Navigated to the MATLAB Engine API directory (D:\matlab\install\extern\engines\python).
- Ran python setup.py install to install the MATLAB Engine API.
- 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!
0 Comments
Answers (1)
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.
0 Comments
See Also
Categories
Find more on Call MATLAB from Python in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!