The correct choice is %pip . Azure Machine Learning compute instances can contain multiple Jupyter kernels, so package installation must target the interpreter associated with the notebook ' s currently active kernel . Microsoft explicitly recommends the %pip or %conda IPython magic commands for this purpose because these commands install packages into the environment associated with the running kernel.
For example, a notebook cell can contain:
%pip install scikit-learn
This ensures that the installed package becomes available to code executed by that notebook kernel.
By contrast, !pip invokes a shell command. Microsoft specifically warns against using !pip or !conda when the intention is to modify only the current notebook kernel, because shell-level package commands can reference environments or packages outside the active kernel.
%load has an entirely different purpose: it loads Python source code into a notebook cell and does not perform package installation.
Therefore, when package installation must be isolated to the active Azure Machine Learning notebook kernel, %pip is the appropriate magic command .
Study Guide Reference: Design and implement an MLOps infrastructure — Azure Machine Learning development environments, notebook kernels, dependency management, and compute instances.