Follow

How do i add packages/libraries to my notebook?

As CloudStor SWAN is a shared environment, you can not simply install packages over the top of the pre-installed environment. Instead you can install packages to your local account.

 

Python

In order to install a Python library that is not installed run the following in your notebook:

!pip install --user xarray

Where xarray is the name of the missing library. 

 

R

In order to install a R library that is not installed requires some extra setup:

#create a local directory for the local files to live in
#(Creates a folder call "R" in your CloudStor home)
dir.create('/webdav/R', showWarnings = FALSE)

#add the local directory to R's libs
.libPaths(new='/webdav/R')

#install a package (zip) locally
install.packages("zip", lib="/webdav/R")

#import the lib (zip)
library(zip, lib="/webdav/R")

Where zip is the missing library