Cannot initialize MATLAB Runtime Instance, unsure why?

20 views (last 30 days)
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!
  1 Comment
Kojiro Saito
Kojiro Saito on 5 Aug 2021
How do you call the python script above? From MATLAB or from Command Prompt?

Sign in to comment.

Answers (1)

Saurabh
Saurabh on 1 Oct 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.

Categories

Find more on Python Package Integration 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!