- https://www.mathworks.com/help/releases/R2020b/matlab/matlab_external/install-the-matlab-engine-for-python.html
- https://www.mathworks.com/help/releases/R2020b/matlab/matlab_external/install-matlab-engine-api-for-python-in-nondefault-locations.html
Matlab Engine for Python: Import Error: cannot import name "double" from "mlarray"
10 views (last 30 days)
Show older comments
Trying to use Matlab engine for python with pyqtgraph for real-time data display.
The matlab version is R2020b and I am on Windows
I can't post the actual code, but in the python file I am using the engine in, I create an instance of a class and repeatedly call a method that gets data from that class and then I want to plot that data.
I am considering trying this on R2022b if I have no luck with R2020b for this application.
Here is the ful llist of exceptions raised by python, I have removed the first part of the absolute path, but each begins at the root of the python virtual environment directory:
- Traceback (most recent call last):
- File "lib\site-packages\pyqtgraph\multiprocess\remoteproxy.py", line 224, in handleRequest
- opts = pickle.loads(optStr)
- File "lib\site-packages\matlab\mlarray.py", line 31, in <module>
- from _internal.mlarray_sequence import _MLArrayMetaClass
- File "lib\site-packages\matlab\_internal\mlarray_sequence.py", line 3, in <module>
- from _internal.mlarray_utils import _get_strides, _get_size, \
- File "lib\site-packages\matlab\_internal\mlarray_utils.py", line 8, in <module>
- import matlab
- File "lib\site-packages\matlab\__init__.py", line 24, in <module>
- from mlarray import double, single, uint8, int8, uint16, \
- ImportError: cannot import name 'double' from 'mlarray' (lib\site-packages\matlab\mlarray.py)
0 Comments
Answers (1)
Nihal Reddy
on 15 Feb 2023
This is likely due to MATLAB Engine not being installed correctly. Please see the below documentation references:
In particular, make sure that you call the installation script with the version of Python you intend to use and that your Python path is updated accordingly.
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!