Installing Additional ML Runtimes Packages

Cloudera Machine Learning Runtimes are preloaded with a few common packages and libraries for Python. However, a key feature of Cloudera Data Science Workbench is the ability of different projects to install and use libraries pinned to specific versions, just as you would on your local computer.

Before downloading or using third-party content, you are responsible for reviewing and complying with any applicable license terms and making sure that they are acceptable for your use case.

Generally, Cloudera recommends you install all required packages locally into your project. This will ensure you have the exact versions you want and that these libraries will not be upgraded when Cloudera upgrades the ML Runtimes image. You only need to install libraries and packages once per project. From then on, they are available to any new ML Runtimes you spawn throughout the lifetime of the project.

You can install additional libraries and packages from the workbench, using either the command prompt or the terminal.

(Python) Install Packages Using Workbench Command Prompt

To install a package from the command prompt:
  1. Navigate to your project's Overview page. Click Open Workbench and launch a session.
  2. At the command prompt (see Native Workbench Console and Editor) in the bottom right, enter the command to install the package. Some examples using Python have been provided.

Python 3

# Installing from console using ! shell operator and pip3:
!pip3 install beautifulsoup4

# Installing from terminal
pip3 install beautifulsoup4

(Python Only) Using a Requirements File

For a Python project, you can specify a list of the packages you want in a requirements.txt file that lives in your project. The packages can be installed all at once using pip/pip3.

  1. Create a new file called requirements.txt file within your project:
  2. To install the packages in a Python 3 ML Runtimes, run the following command in the workbench command prompt.
    !pip3 install -r requirements.txt