Install packages from within a notebook

Although you can configure the environment for your notebook on the project level, you may want to install packages directly within an individual notebook.

Packages installed from the notebook apply only to the current server session. Package installations aren't persisted once the server is shut down.

Python

Packages in Python can be installed using either pip or conda using commands within code cells:

!pip install <package_name>

!conda install <package_name> -y

If the command output indicates that the requirement is already satisfied, then Azure Notebooks may include the package by default. The package might also be installed through a project environment setup step.

R

Packages in R can be installed from CRAN or GitHub using the install.packages function in a code cell:

install.packages("package_name")

You can also install prerelease versions and other development packages from GitHub using the devtools library:

options(unzip = 'internal')
library(devtools)
install_github('<user>/<repo>')

F#

Packages in F# can be installed from nuget.org by calling the Paket dependency manager from within code cells. First, load the Paket manager:

#load "Paket.fsx"

Then install packages:

Paket.Package
[ "MathNet.Numerics"
"MathNet.Numerics.FSharp"
]

Next steps