sean_owen
Databricks Employee
Databricks Employee

%sh pip just executes the pip command on the local driver machine. It will work just like pip does on the command line anywhere else to install packages from PyPI, but, it will only affect the driver machine. By itself, this does not establish a virtualenv, so other users of the cluster could observe the installed package, too.

%pip uses the same syntax to install packages, but is a 'magic' command that actually runs commands to install the same package across all machines in the cluster. It sets up a virtualenv specific to each notebook execution to isolate the package installation from other jobs and users.