Skip to content

Commit 6ff852c

Browse files
zainh-mwprabhakk-mw
authored andcommitted
Updates to README files.
1 parent 41bbb13 commit 6ff852c

File tree

3 files changed

+37
-126
lines changed

3 files changed

+37
-126
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ cd jupyter-matlab-proxy
8080
python -m pip install .
8181
```
8282

83-
### Integration with JupyterHub
83+
### Using JupyterHub
8484

8585
To use MATLAB with JupyterHub, 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, install this package in the Docker image used to launch those containers, using the instructions for [Using MATLAB Integration _for Jupyter_ in a Docker Container](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tree/main/matlab).
8686

@@ -151,13 +151,23 @@ This opens a Jupyter notebook that supports MATLAB.
151151
### Notes
152152

153153
- **Licensing:** When you execute MATLAB code in a notebook for the first time, enter your MATLAB license information in the dialog box that appears. For details, see [Licensing](https://github.com/mathworks/matlab-proxy/blob/main/MATLAB-Licensing-Info.md). The MATLAB session can take a few minutes to start.
154-
- **Multiple notebooks:** Multiple notebooks running on a Jupyter server share the underlying MATLAB process, so executing code in one notebook affects the workspace in others. If you work in several notebooks simultaneously, be aware that they share a workspace.
155-
- **Local functions:** with MATLAB R2022b and later, you can define a local function at the end of the cell where you want to call it:
154+
155+
- **MATLAB Kernel:** The MATLAB kernel supports tab completion and rich outputs:
156+
* Inline static plot images
157+
* LaTeX representation for symbolic expressions
158+
* Tables formatted using HTML instead of ASCII, in MATLAB R2024a and later:
159+
| Before R2024a | After R2024a |
160+
|--|--|
161+
|<p align="center"><img width="450" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/tables_before_r2024a.png"></p> | <p align="center"><img width="400" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/tables_after_r2024a.png"></p> |
162+
163+
For a technical overview of the MATLAB kernel, see [MATLAB Kernel for Jupyter](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/src/jupyter_matlab_kernel/README.md).
164+
165+
- **Multiple notebooks:** Multiple notebooks running on a Jupyter server share the underlying MATLAB process, so executing code in one notebook affects the workspace in others. If you work in several notebooks simultaneously, be aware they share a workspace. For details, see [MATLAB Kernel for Jupyter](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/src/jupyter_matlab_kernel/README.md).
166+
- **Local functions:** With MATLAB R2022b and later, you can define a local function at the end of the cell where you want to call it:
156167
<p><img width="350" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/local_functions.png"></p>
157168

158169
- **Magic Commands:** You can use predefined magic commands in a Jupyter notebook with the MATLAB kernel, and you can also implement your own. To see a list of predefined magic commands, run `%%lsmagic`. For details about using magic commands, see [Magic Commands for MATLAB Kernel](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/src/jupyter_matlab_kernel/magics/README.md).
159170

160-
- **Kernel:** For technical details about the MATLAB kernel, see [MATLAB Kernel for Jupyter](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/src/jupyter_matlab_kernel/README.md).
161171

162172
## Open MATLAB in a Browser
163173

src/jupyter_matlab_kernel/README.md

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,38 @@
11
# MATLAB Kernel for Jupyter
22

3-
This module is a part of the `jupyter-matlab-proxy` package and it provides a Jupyter kernel for the MATLAB language.
3+
This page provides a technical overview of the MATLAB kernel used in the [MATLAB Integration for Jupyter](https://github.com/mathworks/jupyter-matlab-proxy).
44

5-
## Usage
6-
7-
Upon successful installation of `jupyter-matlab-proxy`, your Jupyter environment should present several options for using MATLAB in Jupyter.
8-
9-
Click on `MATLAB Kernel` to create a Jupyter notebook for MATLAB.
5+
After installing the MATLAB Integration for Jupyter, your Jupyter environment shows different options for using MATLAB in Jupyter. Click `MATLAB Kernel` to start a Jupyter notebook.
106

117
|Jupyter Notebook| JupyterLab |
128
|--|--|
139
|<p align="center"><img width="200" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/classic-jupyter-kernel.png"></p> | <p align="center"><img width="500" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/jupyterlab_kernel_icon.png"></p> |
1410

15-
## Architecture
16-
17-
|![kernelArchitecture](https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/kernel-architecture.png)|
18-
|-|
19-
20-
**Key takeaways:**
21-
22-
* When a notebook is opened, a new kernel is created for it.
2311

24-
* When the first execution request is made the following occurs:
25-
* A licensing screen is presented if this information has not been provided previously.
26-
* A MATLAB process is launched by Jupyter if one has not been launched previously.
2712

28-
* Every subsequent notebook does **not** ask for licensing information or launch a new MATLAB process.
13+
## Technical Overview
2914

30-
* Every notebook communicates with MATLAB through the Jupyter notebook server.
3115

32-
* A notebook can be thought of as another view into the MATLAB process.
33-
* Any variables or data created through the notebook manifests in the spawned MATLAB process.
34-
* This implies that all notebooks access the same MATLAB workspace, and users must keep this in mind when working with multiple notebooks.
16+
|<p align="center"><img width="600" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/kernel-architecture.png"></p>|
17+
|--|
18+
|The diagram above illustrates that multiple Jupyter notebooks communicate with a shared MATLAB process, through the Jupyter notebook server.|
3519

36-
* If simultaneous execution requests are made from two notebooks, they are processed by MATLAB in a **first-in, first-out basis**.
20+
Start a Jupyter notebook to create a MATLAB kernel. When you run MATLAB code in a notebook for the first time, you see a licensing screen to enter your MATLAB license details. If a MATLAB process is not already running, Jupyter will start one.
3721

38-
* Kernel interrupts can be used to interrupt the execution that is currently being processed by MATLAB.
22+
Multiple notebooks share the same MATLAB workspace. MATLAB processes commands from multiple notebooks in on a first-in, first-out basis.
3923

40-
**Note**: If cells from multiple notebooks are being run at the same time, the execution request that gets interrupted may not be the one from which the interrupt was requested.
24+
You can use kernel interrupts to stop MATLAB from processing a request. Remember that if cells from multiple notebooks are being run at the same time, the execution request you interrupt may not be from the notebook where you initated the interrupt.
4125

42-
## Key Features
43-
* Tab completion
44-
* Execution of MATLAB code
45-
* Rich outputs including:
46-
* Inline static plot images
47-
* LaTeX representation for symbolic expressions
48-
* **For MATLAB R2022b and later:** Local functions can be defined at the end of a cell for use in the same cell
49-
<p><img src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/local_functions.png"></p>
50-
* **For MATLAB R2024a and later:** Tables are formatted using HTML instead of ASCII
51-
| Before R2024a | After R2024a |
52-
|--|--|
53-
|<p align="center"><img width="550" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/tables_before_r2024a.png"></p> | <p align="center"><img width="500" src="https://github.com/mathworks/jupyter-matlab-proxy/raw/main/img/tables_after_r2024a.png"></p> |
5426

5527
## Limitations
56-
Please refer to this [README](https://github.com/mathworks/jupyter-matlab-proxy#limitations) file for a listing of the current limitations.
28+
For limitations of the MATLAB kernel, see [Limitations](https://github.com/mathworks/jupyter-matlab-proxy/blob/main/Limitations.md).
5729

5830
## Feedback
5931

60-
We encourage you to try this repository with your environment and provide feedback.
61-
If you encounter a technical issue or have an enhancement request, create an issue [here](https://github.com/mathworks/jupyter-matlab-proxy/issues) or send an email to `[email protected]`
32+
To request an enhancement or technical support, [create a GitHub issue](https://github.com/mathworks/jupyter-matlab-proxy/issues) or send an email to `[email protected]`.
6233

6334
----
6435

65-
Copyright 2023 The MathWorks, Inc.
36+
Copyright 2023-2024 The MathWorks, Inc.
6637

6738
----

troubleshooting/troubleshooting.md

Lines changed: 11 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,35 @@
11
# Troubleshooting guide for MATLAB Integration _for Jupyter_
2-
We have provided a Python script, troubleshooting.py, which runs basic environment checks to determine if the required dependencies are met or not. This script does not send the information anywhere remotely and just relays information to the terminal window.
2+
3+
This folder contains `troubleshooting.py`, a Python script that checks your environment for the dependencies required to run [MATLAB Integration for Jupyter](https://github.com/mathworks/jupyter-matlab-proxy/tree/main). The script prints the results in your terminal.
34

45

56
## Table of Contents
67
1. [Requirements](#requirements)
7-
2. [Running the script](#running-the-script)
8+
2. [Run Troubleshooting Script](#run-troubleshooting-script)
89
3. [Enable Logging](#enable-logging)
910

1011
## Requirements
11-
* Python
12-
13-
## Running the script
14-
One can run the latest version of the troubleshooting script using the following command:
15-
16-
```bash
17-
$ curl https://raw.githubusercontent.com/mathworks/jupyter-matlab-proxy/main/troubleshooting/troubleshooting.py | python -
18-
```
12+
- Python
1913

20-
Ensure that the `python` executable used to run this script is from the same environment in which you intend to use the integration.
14+
## Run Troubleshooting Script
2115

22-
Also, if you are on a platform that doesn't support `curl`, please consider downloading the [troubleshooting.py](https://raw.githubusercontent.com/mathworks/jupyter-matlab-proxy/main/troubleshooting/troubleshooting.py) and running it as:
16+
Ensure the Python executable you use to run the troubleshooting script is in the same environment where you want to use the integration.
2317

24-
```bash
25-
$ python troubleshooting.py
26-
```
18+
Run the troubleshooting script:
2719

28-
Alternatively, you can manually execute the below commands in the environment where you have installed the package:
29-
30-
* Verify that the MATLAB executable is on the PATH
3120
```bash
32-
$ which matlab
33-
/usr/local/bin/matlab
34-
```
35-
36-
* Check if the Python version is 3.8 or higher
37-
```bash
38-
$ python --version
39-
Python 3.8.3
40-
```
41-
42-
* Ensure that `matlab-proxy-app` and the `jupyter` executables are in the same environment as the Python executable.
43-
For example, if you are using VENV to manage your Python environments:
44-
```bash
45-
$ which python
46-
/home/user/my-project/packages/.venv/bin/python
47-
48-
$ which matlab-proxy-app
49-
/home/user/my-project/packages/.venv/bin/matlab-proxy-app
50-
51-
$ which jupyter
52-
/home/user/my-project/packages/.venv/bin/jupyter
21+
$ curl https://raw.githubusercontent.com/mathworks/jupyter-matlab-proxy/main/troubleshooting/troubleshooting.py | python -
5322
```
54-
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`
5523

56-
* Ensure that you are launching `jupyter lab` using the same executable listed above.
24+
If your platform does not support `curl`, download [troubleshooting.py](https://raw.githubusercontent.com/mathworks/jupyter-matlab-proxy/main/troubleshooting/troubleshooting.py) and run it:
5725

58-
* Ensure that all three packages are installed in the same Python environment
5926
```bash
60-
# Pipe the output of pip freeze and grep for jupyter, matlab-proxy and jupyter-matlab-proxy.
61-
# All three packages should be highlighted in the output.
62-
# If you don't see any one of them, then either the packages missing in the output have been installed
63-
# in a different Python environment or not installed at all.
64-
$ pip freeze | grep -E "jupyter|matlab-proxy|jupyter-matlab-proxy"
65-
```
66-
67-
* If the integration is not a visible option in the dropdown box inside the Jupyter Notebook:
68-
```bash
69-
#Run the following commands and verify that you are able to see similar output:
70-
71-
$ jupyter serverextension list
72-
config dir: /home/user/anaconda3/etc/jupyter
73-
jupyter_server_proxy enabled
74-
- Validating...
75-
jupyter_server_proxy OK
76-
jupyterlab enabled
77-
- Validating...
78-
jupyterlab 3.5.1 OK
79-
80-
$ jupyter nbextension list
81-
Known nbextensions:
82-
config dir: /home/user/anaconda3/etc/jupyter/nbconfig
83-
notebook section
84-
jupyter-js-widgets/extension enabled
85-
- Validating: OK
86-
tree section
87-
jupyter_server_proxy/tree enabled
88-
- Validating: OK $ pip freeze | grep -E "jupyter|matlab-proxy|jupyter-matlab-proxy"
89-
90-
$ jupyter labextension list
91-
jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
92-
jupyter_matlab_labextension v0.1.0 enabled OK
93-
@jupyterlab/server-proxy v3.2.2 enabled OK
94-
95-
96-
# IF the server does not show up in the commands above, install:
97-
$ pip install jupyter-contrib-nbextensions
27+
$ python troubleshooting.py
9828
```
9929

10030
## Enable Logging
10131

102-
You can use logs to assist debugging while using MATLAB Integration for Jupyter. Set the environment variable `MWI_JUPYTER_LOG_LEVEL` to one of the following: `NOTSET`, `DEBUG`, `INFO`, `WARN`, `ERROR`, or `CRITICAL`. The default value is `INFO`. For more information on Python log levels, see [Logging Levels](https://docs.python.org/3/library/logging.html#logging-levels).
32+
You can use logs to assist debugging when using MATLAB Integration for Jupyter. Set the environment variable `MWI_JUPYTER_LOG_LEVEL` to one of the following: `NOTSET`, `DEBUG`, `INFO`, `WARN`, `ERROR`, or `CRITICAL`. The default value is `INFO`. For more information on Python log levels, see [Logging Levels (Python)](https://docs.python.org/3/library/logging.html#logging-levels).
10333

10434
To set the environment variable, use the appropriate command for your environment. For example, in Linux, use the following:
10535

0 commit comments

Comments
 (0)