> ## Documentation Index
> Fetch the complete documentation index at: https://docs.domino.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Use TensorBoard in Jupyter Workspaces

[TensorBoard](https://www.tensorflow.org/programmers_guide/summaries_and_tensorboard) is a tool for visualizing TensorFlow data. TensorBoard operates by reading events files, which contain summary data that generated by TensorFlow. You can visualize your TensorFlow graph, plot quantitative metrics about graph, and show additional data that passes through the graph.

You can install and enable the [Jupyter-TensorBoard](https://github.com/lspvic/jupyter_tensorboard) server extension in your compute Environment to use TensorBoard in your Domino Jupyter.

## Set up your Environment

You must create or modify an Environment to enable this extension in your Domino Workspaces. See [Environment Management](/cloud/platform-capabilities/core-concepts/compute-environments/manage-compute-environments).

1. In the navigation bar, click **Environments**.

2. Click **Create Environment**.

3. Give the Environment a name, and then select a base image that has Python 3.8 installed. You can use an Environment as a base image if it uses this Domino standard:

   `quay.io/domino/compute-environment-images:ubuntu20-py3.9-r4.3-domino5.10-gpu` `quay.io/domino/domino-gpu-environment:develop.3d96fa12`

4. After setting the **Visibility** and entering a description, click **Create Environment**. The Environment’s Overview page opens.

5. Go to **Docker Settings** and click **Edit Dockerfile**.

6. Add the following lines to the **Dockerfile Instructions**:

   ```dockerfile theme={null}
   USER root

   RUN apt-get update
   RUN apt-get install -y --no-install-recommends libnode-dev npm nodejs
   RUN npm install -g configurable-http-proxy
   RUN pip install -U jupyter jupyter-tensorboard jupyter-server-proxy ipywidgets

   USER ubuntu
   ```

7. Add the following lines to the **Pluggable Workspace Tools** to add JupyterLab workspace:

   ```dockerfile theme={null}
   jupyterlab:
     title: "JupyterLab"
     iconUrl: "/assets/images/workspace-logos/jupyterlab.svg"
     start: [  "/opt/domino/workspaces/jupyterlab/start" ]
     httpProxy:
       internalPath: "/{{ownerUsername}}/{{projectName}}/{{sessionPathComponent}}/{{runId}}/{{#if pathToOpen}}tree/{{pathToOpen}}{{/if}}"
       port: 8888
       rewrite: false
       requireSubdomain: false
   ```

8. Add the following lines to the **Pre-run script** if the Project you plan to use in this Compute Environment is a Domino Project:

   ```dockerfile theme={null}
   #!/bin/bash
   set -e

   # Ensure required packages are installed (optional safety step)
   pip install --quiet --upgrade jupyter-server-proxy tensorboard "notebook<7"

   # Create Jupyter config directory
   CONF_DIR="${HOME}/.jupyter"
   mkdir -p "${CONF_DIR}"

   # Write valid server proxy config for TensorBoard
   cat << EOF > "${CONF_DIR}/jupyter_notebook_config.py"
   c.ServerProxy.servers = {
       "tensorboard": {
           "command": [
               "tensorboard",
               "--logdir", "/domino/datasets/local/${DOMINO_PROJECT_NAME}/tensorboard_logs",
               "--host", "0.0.0.0",
               "--port", "{port}"
           ],
           "timeout": 30,
           "launcher_entry": {
               "title": "TensorBoard"
           }
       }
   }
   EOF
   ```

9. Add the following lines to the **Pre-run script** if the Project is a Git-based Project:

   ```dockerfile theme={null}
   #!/bin/bash
   set -e

   # Ensure required packages are installed (optional safety step)
   pip install --quiet --upgrade jupyter-server-proxy tensorboard "notebook<7"

   # Create Jupyter config directory
   CONF_DIR="${HOME}/.jupyter"
   mkdir -p "${CONF_DIR}"

   # Write valid server proxy config for TensorBoard
   cat << EOF > "${CONF_DIR}/jupyter_notebook_config.py"
   c.ServerProxy.servers = {
       "tensorboard": {
           "command": [
               "tensorboard",
               "--logdir", "/mnt/data/${DOMINO_PROJECT_NAME}/tensorboard_logs",
               "--host", "0.0.0.0",
               "--port", "{port}"
           ],
           "timeout": 30,
           "launcher_entry": {
               "title": "TensorBoard"
           }
       }
   }
   EOF
   ```

10. Click **Build**.

    The **Revisions** page opens. If the new revision builds successfully, you can use this Environment.

## Use Jupyter-TensorBoard

1. Open the Project you want to use with Jupyter-Tensorboard.

2. In the navigation pane, click **Settings**.

3. From **Compute Environment**, select the Environment you created previously. A notification opens to verify that the new Environment is now set.

4. In the navigation pane, click **Workspaces**, then select **Jupyterlab** and launch a new workspace.

5. Select **Tensorboard** from the Launcher.

See the [TensorBoard README](https://github.com/tensorflow/tensorboard/blob/master/README.md) to learn how to consume TensorFlow events.

## Troubleshooting

1. If you encounter issues loading Tensorboard initially, confirm that Tensorflow is operating properly. Loading the application depends on Tensorflow.

2. By default, Domino’s standard Compute Environments have `tensorflow-gpu` installed (for example, `pip install tensorflow-gpu`). Therefore, Tensorboard and Tensorflow will not work on a CPU hardware tier. If you’d like to use Tensorboard on a CPU, make sure that CPU optimized Tensorflow is installed (for example, `pip install tensorflow`).
