Help Center> ModelArts> FAQs> Notebook (New Version)> Environment Configurations> How Do I Install External Libraries in a Notebook Instance?
Updated on 2023-11-22 GMT+08:00

How Do I Install External Libraries in a Notebook Instance?

Multiple environments such as Jupyter and Python have been integrated into ModelArts notebook to support many frameworks, including TensorFlow, MindSpore, PyTorch, and Spark. You can use pip install to install external libraries in Jupyter Notebook or on the Terminal page.

Installing External Libraries in Jupyter Notebook

You can use JupyterLab to install Shapely in the TensorFlow-1.8 environment.

  1. Open a notebook instance and access the Launcher page.
  2. In the Notebook area, click TensorFlow-1.8 and create an IPYNB file.
  3. In the new notebook instance, enter the following command in the code input bar:

    !pip install Shapely

Installing External Libraries on the Terminal Page

You can use pip to install external libraries in the TensorFlow-1.8 environment on the Terminal page. For example, to install Shapely:

  1. Open a notebook instance and access the Launcher page.
  2. In the Other area, click Terminal and create a terminal file.
  3. Enter the following commands in the code input box to obtain the kernel of the current environment and activate the Python environment on which the installation depends:

    cat /home/ma-user/README

    source /home/ma-user/anaconda3/bin/activate TensorFlow-1.8

    To install TensorFlow in another Python environment, replace TensorFlow-1.8 in the command with the target engine.

    Figure 1 Activating the environment
  4. Run the following command in the code input box to install Shapely:

    pip install Shapely

Environment Configurations FAQs

more