Libraries and scripts for notebooks (Watson Studio)
Watson Studio includes many preinstalled libraries for Python and R in its runtime environments:
- Spark libraries, such as, SparkSQL, Spark Streaming, and Spark MLlib
- A large selection of open source libraries
- ibm-watson-studio-lib for Python
- ibm-watson-studio-lib for R
- Brunel is not pre-installed on Watson Studio environments with Python version 3.7 or later.
- PixieDust will not be pre-installed on Watson Studio environments with Python version 3.8 or later.
To work with Scala in a notebook, use a Spark environment.
Listing installed libraries
Many of your favorite open source libraries are pre-installed on Watson Studio environments. All you have to do is import them. See Import preinstalled libraries and packages.
If a library is not preinstalled, you can add it:
- Through the notebook
- By adding a customization to the environment in which the notebook runs
The advantage of adding an environment customization is that the library is preinstalled each time the environment runtime is started. Libraries that you add through a notebook are persisted for the lifetime of the runtime only. If the runtime is stopped and later restarted, those libraries are not installed.
To see the list of installed libraries in your environment runtime:
From a notebook, run the appropriate command from a notebook cell:
- Python: `!pip list --isolated` - R: `installed.packages()`
Optional: Add custom libraries and packages to the environemnt. See customizing an environment definition.
Importing an installed library
To import an installed library into your notebook, run the appropriate command from a notebook cell with the library name:
Alternatively, you can write a script that includes multiple classes and methods and then import the script into your notebook.