Libraries and scripts for notebooks
Watson Studio includes many preinstalled libraries for Python and R in its runtime environments:
- Spark libraries, such as, SparkSQL, Spark Streaming, and Spark MLlib
- Open source visualization libraries, such as GraphX
- PixieDust helper library
- Brunel visualization library
- SPSS model visualization library
- Deep learning libraries
- SPSS predictive analytics algorithms
- Decision Optimization
- Python project-lib library
- R project-lib library
To work with Scala in a notebook, use a Spark environment.
Listing installed libraries
Before you install any libraries by way of a notebook, you should check if those libraries are already preinstralled in the runtime environment. If a library is not preinstalled, you should customize the environment definition and not add this library through the notebook. That way, the library is preinstalled each time the environment runtime is started. Libraries that you add to your environment runtime 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.
You can only customize a CPU environment definition that you created; you can’t customize the preset default CPU environment definitions provided by Watson Studio. For the other environment types, like Spark and GPU, you need to install custom or additional libraries through the notebook.
To see the list of installed libraries in a default CPU environment:
For default CPU environments:
- Click your project’s Environments tab.
- From the Environment definitions list, click the environment definition you want to use. This opens the environment definition details page where you can see the list of installed libraries.
- Optional: Add custom libraries and packages. See customizating the software configuration.
For all other environments:
From a notebook, run the appropriate command from a notebook cell:
!pip list --isolated
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. Watch this video to see how to use the Spark Machine Learning Libraries.