Cannot initialize MATLAB Runtime Instance, unsure why?

27 visualizzazioni (ultimi 30 giorni)
Hello! I am working on distributing a Python package that does some image analysis. At some point within the pipeline, MATLAB is used and as such needs to be installed by the user. I am trying to use MATLAB runtime but am getting the error below:
SystemError: Error initializing MATLAB Runtime: Warning: Cannot initialize MATLAB Compiler-generated software component in MATLAB. MATLAB Compiler-generated software components cannot be used from within MATLAB.
I have no idea what is going on since MATLAB is being called from a function inside my Python package. Below is the way in which I call it which may be the issue?
import pharedox_registration
def standardization(
profile_data: xr.DataArray,
redox_params,
template: Union[xr.DataArray, np.ndarray] = None,
**reg_kwargs,
) -> Tuple[xr.DataArray, xr.DataArray]:
matlabeng = pharedox_registration.initialize()
Another idea I have as to what the error could be is that elsewhere in the program, matlab engine is used (not in the same file). While the end desire is to get rid of the use of the matlab engine I am attempting to test before I completely switch to MATLAB Runtime. I was wondering if that may be the issue? Any help would be much apprecitated!

Risposte (1)

Saurabh
Saurabh il 1 Ott 2024
I encountered a similar issue and, upon examining the documentation, identified a limitation that prevents the concurrent use of both the MATLAB Engine and PySDK within the same Python session. As a result, it is not feasible to import 'matlab.engine' after importing the component, or vice versa.
The same information can be found here:
I hope this helps.

Categorie

Scopri di più su Python Package Integration in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by