Python compatibility r2023 b

18 visualizzazioni (ultimi 30 giorni)
Stanley
Stanley il 14 Nov 2023
Risposto: atharva il 16 Nov 2023
Hi I followed the exact steps and I recently installed R2023b. I find the below error:I have Python 3.11.1
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is not a package

Risposte (1)

atharva
atharva il 16 Nov 2023
Hey Stanley,
I understand that you are facing the error "ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is not a package".
One way to potentially resolve this issue is to point the "PYTHONPATH" environment variable to the directory containing the install of MATLAB Engine.This update should trigger the correct location to be searched for the necessary modules when importing.
If you are installing in a non-default location, remember to add the location to the 'PYTHONPATH' path variable. Failing to do so would mean that Python would not be able to find the MATLAB engine module.
This link discusses how to add a location to the python path:
The missing module should have been located in the following directory for 64-bit Linux machines:
\matlab\extern\engines\python\dist\matlab\engine\glnxa64
After performing re-installation, check this directory to see if it contains the MATLAB engine module. Do check that the right version of the module has been installed.
If this step does not work, one debugging step is to run Python in verbose mode when importing the module. Python can be started in verbose mode using the following command: "python -vvv".
I hope this helps!

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by