1. Severity of the issue: (select one)
High: Completely blocks me.
2. Environment:
- Ray version: 2.6.3/2.51.1
- Python version: 3.10.19
- OS: Windows 11
- Cloud/Infrastructure: N/A
- Other libs/tools (if relevant):
- Matlab-Engine: 25.2.2
- Conda
I’m running into some compatibility issues with running RayRLlib in the same script as Matlab Engine.
The project I just started working with has our simulation running fully inside Matlab and previously we’ve used Ray 2.6.3 to handle the RL side of things while using Matlab-Engine inside the standard step, reset, etc. functions to call their Matlab equivalent. This hasn’t been an issue previously. However, we’re now trying to update our Ray version and I’m getting DLL issues when just running both packages in the same script.
Note: We are also locked into running everything inside Conda environments if that could cause any issues.
Minimal Example 1:
import matlab.engine
import ray.rllib
eng = matlab.engine.start_matlab()
Gives Error:
Exception has occurred: ImportError
DLL load failed while importing _tree: The specified procedure could not be found.
File "C:\Users\bhabas\Documents\Projects_25\temp_env_test\ray_example.py", line 2, in <module>
import ray.rllib
ImportError: DLL load failed while importing _tree: The specified procedure could not be found.
Minimal Example 2 (Switching Import Order):
import ray.rllib
import matlab.engine
eng = matlab.engine.start_matlab()
Gives Error:
Exception has occurred: EngineError
Loading C:\Program Files\MATLAB\R2025b\bin\win64\mvm_transport\mvm_transport\mwmvmtransport_layered.dllfailed with error: The specified procedure could not be found.
: state not recoverable: state not recoverable
File "C:\Users\bhabas\Documents\Projects_25\temp_env_test\ray_example.py", line 6, in <module>
eng = matlab.engine.start_matlab()
matlab.engine.EngineError: Loading C:\Program Files\MATLAB\R2025b\bin\win64\mvm_transport\mvm_transport\mwmvmtransport_layered.dllfailed with error: The specified procedure could not be found.
: state not recoverable: state not recoverable