0 / 0
Customizing environment templates
Last updated: Nov 27, 2024
Customizing environment templates

You can change the name, the description, and the hardware configuration of an environment template that you created. You can customize the software configuration of Jupyter notebook environment templates through conda channels or by using pip. You can provide a list of conda packages, a list of pip packages, or a combination of both. When using conda packages, you can provide a list of additional conda channel locations through which the packages can be obtained.

Required permissions
You must be have the Admin or Editor role in the project to customize an environment template.
Restrictions
You cannot change the language of an existing environment template.
You can’t customize the software configuration of a Spark environment template that you created.

To customize an environment template that you created:

  1. Under your project's Manage tab, click the Environments page.
  2. In the Active Runtimes section, check that no runtime is active for the environment template that you want to change.
  3. In the Environment Templates section, click the environment template that you want to customize.
  4. For Python-based templates, if you want to add interactive elements like sliders, buttons, dropdowns, and text boxes to your notebook by using the IPyWidgets library, select the IPyWidgets checkbox.
  5. For Juypter notebook environment templates, if you want to add packages, click Create and specify the libraries to add to the standard packages that are available by default. You can also use the customization to upgrade or downgrade packages that are part of the standard software configuration.
  6. If you didn't add any package customizations, close the window to apply your changes. If you added new pakages, you must click Apply.

Important when customizing packages:

  • Libraries that you add to an environment template through customization are automatically installed each time that the environment runtime is started. Other project members who usee this template are able to use this package, too. Note that customizations that are added in a cell of an already running notebook are not shared with others.
  • Before you customize a package, verify that the changes that you are planning have the intended effect.
    • conda can report the changes required for installing a given package, without actually installing it. You can verify the changes from your notebook. For example, for the library Plotly:
      • In a Python notebook, enter: !conda install --dry-run plotly
      • In an R notebook, enter: print(system2("conda", args=c("install","--dry-run","r-plotly"), stdout=TRUE))
    • pip does install the package. However, restarting the runtime again after verification will remove the package. Here too you verify the changes from your notebook. For example, for the library Plotly:
      • In a Python notebook, enter: !pip install plotly
      • In an R notebook, enter: print(system2("pip", args="install plotly", stdout=TRUE))
  • If you can get a package through conda from the default channels and through pip from PyPI, the preferred method is through conda from the default channels.
  • Conda does dependency checking when installing packages which can be memory intensive if you add many packages to the customization. Ensure that you select an environment with sufficient RAM to enable dependency checking at the time the runtime is started.
  • To prevent unnecessary dependency checking if you only want packages from one Conda channel, exclude the default channels by removing defaults from the channels list in the template and adding nodefaults.
  • In addition to the Anaconda main channel, many packages for R can be found in Anaconda's R channel. In R environments, this channel is already part of the default channels, hence it does not need to be added separately.
  • If you add packages only through pip or only through conda to the customization template, you must make sure that dependencies is not commented out in the template.
  • When you specify a package version, use a single = for conda packages and == for pip packages. Wherever possible, specify a version number as this reduces the installation time and memory consumption significantly. If you don't specify a version, the package manager might pick the latest version available, or keep the version that is available in the package.
  • You cannot add arbitrary notebook extensions as a customization because notebook extensions must be pre-installed.

Learn more

Parent topic: Managing compute resources

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more