The error you are encountering may be due to MATLAB R2023a not being in its default installation directory. To resolve this issue, you can add the MATLAB installation directory to the “LD_LIBRARY_PATH” environment variable on Linux systems. You can do this by adding the following line to your “.bashrc” file:
# in .bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<matlabroot>/bin/glnxa64
For macOS users, the environment variable name is DYLD_LIBRARY_PATH, and the path should be “<matlabroot>/bin/maci64”.
Additionally, installing the “matlabengine” library via pip does not always guarantee a compatible version with MATLAB R2023a. It is recommended to download the MATLAB Engine version that is compatible with your MATLAB installation. Specifically, you can install MATLAB Engine version 9.14.7, which is known to be compatible with MATLAB R2023a, using the following command:
pip install matlabengine==9.14.7
For further guidance on identifying the compatible MATLAB Engine version for your installed MATLAB, as well as setting the LD_LIBRARY_PATH for your operating system, please refer to the documentation linked below. The perticular MATLAB Engine library release compatibility from 'Release history' section will provide additional details on appropriate version:
Hope this helps.