Clear Filters
Clear Filters

Matlab Engine for Python: Import Error: cannot import name "double" from "mlarray"

12 views (last 30 days)
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:
  1. Traceback (most recent call last):
  2. File "lib\site-packages\pyqtgraph\multiprocess\remoteproxy.py", line 224, in handleRequest
  3. opts = pickle.loads(optStr)
  4. File "lib\site-packages\matlab\mlarray.py", line 31, in <module>
  5. from _internal.mlarray_sequence import _MLArrayMetaClass
  6. File "lib\site-packages\matlab\_internal\mlarray_sequence.py", line 3, in <module>
  7. from _internal.mlarray_utils import _get_strides, _get_size, \
  8. File "lib\site-packages\matlab\_internal\mlarray_utils.py", line 8, in <module>
  9. import matlab
  10. File "lib\site-packages\matlab\__init__.py", line 24, in <module>
  11. from mlarray import double, single, uint8, int8, uint16, \
  12. ImportError: cannot import name 'double' from 'mlarray' (lib\site-packages\matlab\mlarray.py)

Answers (1)

Nihal Reddy
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.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!