git clone https://github.com/mathworks/jupyter-matlab-proxy.git
cd jupyter-matlab-proxy
python -m pip install .
Usage
Upon successful installation of jupyter-matlab-proxy, your Jupyter environment should present options to launch MATLAB.
Open your Jupyter environment by starting jupyter notebook or lab
# For Jupyter Notebook
jupyter notebook
# For Jupyter Lab
jupyter lab
If you are using Jupyter Notebook (on the left in figure below), on the New menu, select MATLAB. If you are using JupyterLab (on the right in figure below), select the MATLAB icon on the launcher.
If prompted to do so, enter credentials for a MathWorks account associated with a MATLAB license. If you are using a network license manager, change to the Network License Manager tab and enter the license server address instead. To determine the appropriate method for your license type, consult MATLAB Licensing Info.
Wait for the MATLAB session to start. This can take several minutes.
To manage the MATLAB integration for Jupyter, click the tools icon shown below.
Clicking the tools icon opens a status panel with buttons like the ones below:
The following options are available in the status panel (some options are only available in a specific context):
Option
Description
Start MATLAB Session
Start your MATLAB session. Available if MATLAB is stopped.
Restart MATLAB Session
Restart your MATLAB session. Available if MATLAB is running or starting.
Stop MATLAB Session
Stop your MATLAB session. Use this option if you want to free up RAM and CPU resources. Available if MATLAB is running or starting.
Sign Out
Sign out of MATLAB. Use this to stop MATLAB and sign in with an alternative account. Available if using online licensing.
Unset License Server Address
Unset network license manager server address. Use this to stop MATLAB and enter new licensing information. Available if using network license manager.
Feedback
Send us feedback. This action opens your default email application.
Help
Open a help pop-up for a detailed description of the options.
If you need to use functionality that is not yet supported, or for versions of MATLAB earlier than R2020b, you can use the alternative MATLAB Integration for Jupyter using VNC.
Integration with JupyterHub
To use this integration with JupyterHub®, you must install the jupyter-matlab-proxy Python package in the Jupyter environment launched by your JupyterHub platform.
For example, if your JupyterHub platform launches Docker containers, then install this package in the Docker image used to launch them.
In the environment that you have installed the package:
Verify if the MATLAB executable is discoverable (ie. if it is in the PATH)
$ which matlab
/usr/local/bin/matlab
Check if their Python version is 3.6 or higher
$ python --version
Python 3.7.3
Ensure that matlab-proxy-app and the jupyter executables are in the same environment as the python executable.
For example if youare using VENV to manage your python environments:
$ which python
/home/user/my-project/packages/.venv/bin/python
$ which matlab-proxy-app
/home/user/my-project/packages/.venv/bin/matlab-proxy-app
$ which jupyter
/home/user/my-project/packages/.venv/bin/jupyter
Notice that matlab-proxy-app, jupyter and the python executable are in the same parent directory, in this case it is: /home/user/my-project/packages/.venv/bin
Ensure that you are launching jupyter notebook using the same executable as listed above.
Ensure that all three packages are installed in the same python environment
# Pipe the output of pip freeze and grep for jupyter, matlab-proxy and jupyter-matlab-proxy.# All three packages should be highlighted in the output.# If you don't see anyone of them, then either the packages missing in the output have been installed# in a different python environment or not installed at all.
$ pip freeze | grep -E "jupyter|matlab-proxy|jupyter-matlab-proxy"
If the integration is not showing up as an option to the dropdown box in the Juptyer notebook:
#Run the following commands and verify that you are able to see similar output:
$ jupyter serverextension list
config dir: /home/user/anaconda3/etc/jupyter
jupyter_server_proxy enabled
- Validating...
jupyter_server_proxy OK
jupyterlab enabled
- Validating...
jupyterlab 2.2.6 OK
$ jupyter nbextension list
Known nbextensions:
config dir: /home/user/anaconda3/etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
tree section
jupyter_server_proxy/tree enabled
- Validating: OK $ pip freeze | grep -E "jupyter|matlab-proxy|jupyter-matlab-proxy"# IF the server does not show up in the commands above, install:
$ pip install jupyter_contrib_nbextensions
Feedback
We encourage you to try this repository with your environment and provide feedback.
If you encounter a technical issue or have an enhancement request, create an issue here or send an email to jupyter-support@mathworks.com
请发表评论