Install a library with an init script (legacy)

Note

Databricks recommends defining libraries using cluster policies to provide custom configurations for compute environments. Databricks recommends migrating all libraries installed with init scripts to use this pattern. See Add libraries to a policy.

Important

This documentation has been retired and might not be updated. Databricks no longer recommends using init scripts to install libraries.

If your library requires custom configuration, you may not be able to install it using the workspace or cluster library interface. Instead, you can install the library using an init script.

Here is an example of an init script that uses pip to install Python libraries on a Databricks Runtime cluster at cluster initialization.

#!/bin/bash

/databricks/python/bin/pip install astropy