{"id":26129483,"url":"https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter","last_synced_at":"2025-04-13T18:42:26.678Z","repository":{"id":44523432,"uuid":"321465259","full_name":"mathworks-ref-arch/matlab-integration-for-jupyter","owner":"mathworks-ref-arch","description":"Create Jupyter Docker images with MATLAB integration","archived":false,"fork":false,"pushed_at":"2024-12-17T10:50:02.000Z","size":66,"stargazers_count":27,"open_issues_count":0,"forks_count":8,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-27T09:23:38.349Z","etag":null,"topics":["docker","dockerfile","jupyterhub","matlab","matlab-jupyter"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathworks-ref-arch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-14T20:30:42.000Z","updated_at":"2025-02-14T06:26:27.000Z","dependencies_parsed_at":"2023-12-06T14:28:35.406Z","dependency_job_id":"7b5bc952-7b36-469f-8c0f-f445beabd6f9","html_url":"https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks-ref-arch%2Fmatlab-integration-for-jupyter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks-ref-arch%2Fmatlab-integration-for-jupyter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks-ref-arch%2Fmatlab-integration-for-jupyter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathworks-ref-arch%2Fmatlab-integration-for-jupyter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathworks-ref-arch","download_url":"https://codeload.github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248764819,"owners_count":21158158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","dockerfile","jupyterhub","matlab","matlab-jupyter"],"created_at":"2025-03-10T19:49:04.758Z","updated_at":"2025-04-13T18:42:26.642Z","avatar_url":"https://github.com/mathworks-ref-arch.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# MATLAB Integration *for Jupyter* Reference Architecture\n\nTo run MATLAB\u0026reg; in Jupyter\u0026reg; inside a container, use the Dockerfile in this repository. The Dockerfile builds an image with [MATLAB Integration for Jupyter](https://github.com/mathworks/jupyter-matlab-proxy) (GitHub), based on a `jupyter/base-notebook:ubuntu-22.04` base image from [Jupyter Docker Stacks](https://github.com/jupyter/docker-stacks) (GitHub), which ships with Python 3.11. \n\n## Build Instructions\n\n### Get Sources\nAccess this Dockerfile either by directly downloading this repository from GitHub,\nor by cloning this repository and\nthen navigating to the appropriate folder.\n```bash\ngit clone https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter.git\ncd matlab-integration-for-jupyter\n```\n### Build \u0026 Run Docker Container\nBuild the container with a name and tag of your choice.\n```bash\ndocker build -t mifj:R2024b .\n```\n\nRun the container.\n```bash\ndocker run -it -p 8888:8888 --rm mifj:R2024b\n```\n\nTo open JupyterLab, use your browser to visit the address printed in your console of the format `http://\u003chostname\u003e:8888/?token=\u003ctoken\u003e`. The `hostname` is the name of the computer running Docker, and the `token` is the secret token printed in the console. \n\nFor more information on running Jupyter images, see [Jupyter Quick Start](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html#quick-start) (Jupyter Docker Stacks).\n\n## Customize the Image\n\nBy default, the [Dockerfile](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/blob/main/Dockerfile) installs MATLAB for the latest available MATLAB release, without any additional toolboxes or products, into the `/opt/matlab` folder, along with the Python package [jupyter-matlab-proxy](https://github.com/mathworks/jupyter-matlab-proxy), which provides the MATLAB Integration for Jupyter.\n\nTo customize your build, use the options below.\n\n### Customize MATLAB Release, MATLAB Product List, MATLAB Install Location, License Server and other Python Packages\nThe [Dockerfile](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/Dockerfile) supports the following Docker build-time variables.\n\n| Argument Name | Description | Default value |\n|---|---|---|\n| [MATLAB_RELEASE](#build-an-image-for-a-different-release-of-matlab) | The MATLAB release you want to install. | R2024b |\n| [MATLAB_PRODUCT_LIST](#build-an-image-with-a-specific-set-of-products) | Products to install as a space-separated list. For more information, see [MPM.md](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/MPM.md). For example: MATLAB Simulink Deep_Learning_Toolbox Fixed-Point_Designer. | MATLAB |\n| [MATLAB_INSTALL_LOCATION](#build-an-image-with-matlab-installed-to-a-specific-location) | The path to install MATLAB. | /opt/matlab |\n| [LICENSE_SERVER](#build-an-image-configured-to-use-a-license-server) | The port and hostname of the machine that is running the Network License Manager, using the port@hostname syntax. For example: *27000@MyServerName* | *Unset* |\n| [INSTALL_MATLABENGINE](#build-an-image-with-the-matlab-engine-for-python) | Set this value to install the MATLAB Engine for Python into the image. | *Unset* |\n| [INSTALL_VNC](#build-an-image-with-the-matlab-integration-for-jupyter-using-vnc) | Set this value to install the [jupyter-matlab-vnc-proxy](https://github.com/mathworks/jupyter-matlab-vnc-proxy), which allows you to connect to a traditional MATLAB desktop via VNC.| *Unset* |\n\nTo customize your build, use these arguments with the `docker build` command. See these examples:\n\n\n#### Build an Image for a Different Release of MATLAB\nTo build an image for MATLAB R2019b, run:\n```bash\ndocker build --build-arg MATLAB_RELEASE=R2019b -t mifj:R2019b .\n```\n\n#### Build an Image with Specific Products\nTo build an image with MATLAB and Simulink, run:\n```bash\ndocker build --build-arg MATLAB_PRODUCT_LIST='MATLAB Simulink' -t mifj:R2024b .\n```\n\n#### Build an Image with MATLAB Installed in a Specific Location\nTo build an image with MATLAB installed at `/opt/matlab`, use this command.\n```bash\ndocker build --build-arg MATLAB_INSTALL_LOCATION='/opt/matlab' -t mifj:R2024b .\n```\n\n#### Build an Image Configured to Use a License Server\n\nIf you include the license server information with the `docker build` command, you do not have to provide it when running the container.\n```bash\n# Build container with the License Server.\ndocker build --build-arg LICENSE_SERVER=27000@MyServerName -t mifj:R2024b .\n\n# Run the container, without providing license information.\ndocker run -it --rm -p 8888:8888 mifj:R2024b \n```\nAlternatively, to provide the License Server information with `docker run`, you can use the environment variable `MLM_LICENSE_FILE`:\n```bash\ndocker run -it --rm -p 8888:8888 -e MLM_LICENSE_FILE=27000@MyServerName mifj:R2024b\n```\n\nFor more information on using the Network License Manager, see [Use the Network License Manager](https://github.com/mathworks-ref-arch/matlab-dockerfile?tab=readme-ov-file#use-the-network-license-manager) for more information.\n\n#### Build an Image with the MATLAB Engine for Python\nTo build the default image along with the MATLAB Engine for Python for a given MATLAB Release, run:\n```bash\ndocker build --build-arg INSTALL_MATLABENGINE=1 --build-arg MATLAB_RELEASE=R2024b -t mifj:R2024b .\n```\nFor more information, see: \n- [MATLAB Engine for Python](https://github.com/mathworks/matlab-engine-for-python) (GitHub).\n- [Python Versions Compatible with MATLAB Products](https://mathworks.com/support/requirements/python-compatibility.html) (MathWorks).\n\n##### Note:\n* The Dockerfile in this repository an image based on Python 3.11 and the MATLAB Engine for Python only supports this version from MATLAB R2023b onwards.\n* If the MATLAB Engine for Python fails to install, this will not fail the `docker build` command.\n\n#### Build an Image with the MATLAB Integration for Jupyter using VNC\nTo build the default image along with the MATLAB Integration for Jupyter using VNC, run:\n```bash\ndocker build --build-arg INSTALL_VNC=1 -t mifj:R2024b .\n```\nFor more information, see [MATLAB Integration for Jupyter using VNC*(GitHub)*](https://github.com/mathworks/jupyter-matlab-vnc-proxy).\n\n## Installing MATLAB\nThere are 3 ways to include MATLAB in your container image.\n1. Install MATLAB using [MATLAB Package Manager *(mpm)*](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/MPM.md).\n1. [Mount MATLAB on the Image](#mount-matlab-on-the-image).\n1. [Bring Your Own Image (BYOI)](#bring-your-own-image)\n    * Copy MATLAB installation from another container image.\n\n### Install MATLAB using *mpm*\nThe default configuration of the Dockerfile uses *mpm* to install MATLAB and the specified toolboxes into the container image as described in the sections above.\n\n### Mount MATLAB on the Image\nTo provide a MATLAB installation to the container via volume or bind mount, instead of installing MATLAB inside the image, follow the instructions below.\n\nThe Dockerfile assumes that you want to mount MATLAB in the `/opt/matlab` folder. Use the Build Argument `MATLAB_INSTALL_LOCATION` to specify a custom location within the container where you want to mount MATLAB. \n\n#### Build Image\nUse the [Dockerfile Build Arguments](https://docs.docker.com/reference/dockerfile/#arg) `MOUNT_MATLAB` and `MATLAB_RELEASE` with your `docker build` command.\n\n```bash\ndocker build --build-arg MOUNT_MATLAB=1 \\\n             --build-arg MATLAB_RELEASE=R2024b \\\n             -t mifj:mounted .\n```\nThe `MATLAB_RELEASE` argument ensures that the system dependencies required for MATLAB are installed in the container.\n\nNote: When you are mounting MATLAB on the container at run time, you cannot install MATLAB Engine for Python at build time.\n\n#### Specify Mount Location at Container Startup\nIf MATLAB is installed in `/usr/local/MATLAB/R2024b` on your local machine, you can bind mount this folder to `/opt/matlab` using the command shown below:\n```bash\ndocker run -it --rm -v /usr/local/MATLAB/R2024b:/opt/matlab:ro -p 8888:8888 mifj:mounted \n```\nFor more information, see [Bind Mounts (Docker)](https://docs.docker.com/engine/storage/bind-mounts/).\n\nAccess the Jupyter Notebook by following one of the URLs displayed in the output of the docker run command.\n\nThis option is useful when you want to minimize the size of the container as installing MATLAB and its toolboxes can make the image large (greater than 10GB), depending on the MATLAB toolboxes installed.\n\n### Bring Your Own Image\nTo copy an existing MATLAB installation from another container image, specify the image name with the Docker Build Arguments `MATLAB_IMAGE_NAME` and `MATLAB_RELEASE` as shown below:\n\n```bash\n# Copies MATLAB from the Dockerhub Image \"mathworks/matlab:r2024b\" into the image being built.\ndocker build --build-arg MATLAB_IMAGE_NAME=mathworks/matlab:r2024b \\\n             --build-arg MATLAB_RELEASE=R2024b \\\n             -t mifj:copied .\n```\nThe `MATLAB_RELEASE` argument, ensures that the system dependencies required for MATLAB, are installed into the container.\n\n## Pre-Built Images\n\nYou can download several Docker images based on this Dockerfile from the GitHub Container Registry.\n\n### jupyter-matlab-notebook\nThese images are based on `jupyter/base-notebook:ubuntu-22.04` and include:\n* MATLAB\n* MATLAB Integration for Jupyter\n* MATLAB Integration for Jupyter using VNC\n* MATLAB Engine for Python \n    * Only available in pre-built images newer than R2023b\n    * See [Different Versions of OS or Python](#different-versions-of-os-or-python) for more information on installing the engine for older versions of MATLAB.\n\n**Available Tags**: `R2024b`, `R2024a`, `R2023b`, `R2023a`, `R2022b`\n\n**Docker Pull Command**:\n```bash\n# Substitute the tag with your desired version of MATLAB.\ndocker pull ghcr.io/mathworks-ref-arch/matlab-integration-for-jupyter/jupyter-matlab-notebook:R2024b\n```\n### jupyter-mounted-matlab-notebook\nThese images are based on `jupyter/base-notebook:ubuntu-22.04` and include:\n* MATLAB Integration for Jupyter\n* MATLAB Integration for Jupyter using VNC\n* MATLAB Engine for Python \n    * Only available in pre-built images newer than R2023b\n    * See [Compatibility for Different Versions of OS or Python](#compatibility-for-different-versions-of-os-or-python) for more information on installing the engine for older versions of MATLAB.\n\n**Available Tags**: `R2024b`, `R2024a`, `R2023b`, `R2023a`, `R2022b`\n\n**Docker Pull Command**:\n```bash\n# Substitute the tag with your desired version of MATLAB.\ndocker pull ghcr.io/mathworks-ref-arch/matlab-integration-for-jupyter/jupyter-mounted-matlab-notebook:R2024b\n```\nUse the correct version of the image based on the MATLAB release you are mounting on the image.\nFor example to mount `R2022b` from your local machine, that is installed in `/usr/local/MATLAB/R2022b`, use the following `docker run` command:\n```bash\ndocker run -it --rm -v /usr/local/MATLAB/R2022b:/opt/matlab:ro -p 8888:8888 ghcr.io/mathworks-ref-arch/matlab-integration-for-jupyter/jupyter-mounted-matlab-notebook:R2022b\n```\n\n## Compatibility for Different Versions of OS or Python\n\nTo build on older versions of Ubuntu or Python, update the base image used in the Dockerfile with the tags specified in the [Jupyter Docker Stacks](https://github.com/jupyter/docker-stacks?tab=readme-ov-file#using-old-images) repository. \n\nFor example, this page lists `4d70cf8da953` as the tag for an image with `Python 3.10` on `Ubuntu 22.04`.\n\nTo build an image with this base layer, update [Line 66 in the Dockerfile](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/blob/main/Dockerfile#L66) to `FROM quay.io/jupyter/base-notebook:4d70cf8da953`.\n\nThis might be useful if your workflow depends on older versions of Python. For example the MATLAB Engine for Python only supports Python 3.11 from R2023b. Installing it on MATLAB releases older than R2023b would require an older version of Python, and you can use the approach above to build an image with the desired Python version. For more information about Python compatibility for MATLAB Products, see [Python Versions for MATLAB Products](https://mathworks.com/support/requirements/python-compatibility.html).\n\n### MATLAB Dependencies\n\nTo verify that the release of MATLAB you are installing is supported for your operating system, consult the [MATLAB Dependencies](https://github.com/mathworks-ref-arch/container-images/tree/main/matlab-deps) repository. For example, R2024b is currently the only MATLAB Release which supports Ubuntu 24.04. \n\n## Support \u0026 Feedback\nTo submit an enhancement request or request technical support, create an [Issue](https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/issues/new).\n\n\n----\n\nCopyright 2020-2024 The MathWorks, Inc.\n\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks-ref-arch%2Fmatlab-integration-for-jupyter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathworks-ref-arch%2Fmatlab-integration-for-jupyter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathworks-ref-arch%2Fmatlab-integration-for-jupyter/lists"}