Install dependencies

After you create a notebook instance, you might need to install software that your notebook depends on. You can install dependencies using a terminal window, or by adding install commands in a file in your notebook.

An advantage to adding install commands in a file is that, when you share a notebook, the commands to install the dependencies have been saved with the notebook and are available to the users that you share the notebook with.

Install dependencies in a text file

To install dependencies in a text file in a notebook, follow these steps:

  1. Go to the Cloud Console.

  2. Select Notebook instances.

  3. Select Open JupyterLab for the notebook that you want to open.

  4. Select File -> New -> Notebook. This creates a new notebook named "Untitled.ipynb". Select the kernel for your new notebook. For example, "Python 3". You can also create a Python 3 notebook using the Launcher.

    Add a notebook file

    Select File -> Rename notebook and change the name of the untitled notebook to something meaningful, such as "install.ipynb".

    Rename a file

  5. When you open your new notebook, there is a default code cell where you can enter code, in this case Python 3, to install dependencies. For example, to install the mxnet deep learning library, enter the following in the code cell: !pip install mxnet.

    Add code to a notebook cell

  6. Press the run button to run the install command.

    Press run button

  7. When the install is complete, press Ctrl+S to save the notebook.

Install dependencies from a terminal

To install dependencies in a text file in a notebook, follow these steps:

  1. Open your notebook.

  2. Select File -> New -> Terminal to open a terminal window. You can also open a terminal window using the Launcher.

    Open a terminal window

  3. In the terminal window, enter the command to install the software dependency for your notebook instance. For example, to install the mxnet deep learning library, enter the following command: pip install mxnet.

    Run a command in a terminal window

Was this page helpful? Let us know how we did:

Send feedback about...

AI Platform