- Assuming you created a virtual environment called
matlab
, otherwise:
python -m venv matlab
- Activate the venv:
source matlab/bin/activate
- Assuming you have Matlab installed in your OS:
# change matlabroot for your Matlab installation path (default: `/usr/local/MATLAB/<version>`)
cd "matlabroot/extern/engines/python"
python setup.py install
- Install the matlab kernel python package:
pip install matlab_kernel
- Install your matlab kernel (otherwise it won't be seen in Jupyter):
python -m matlab_kernel install --user
Note: Tested with Matlab R2020b
and Python 3.8
.
Sources: