You can install, view, and uninstall third-party libraries on the Terminal interface of a Data Science Workshop (DSW) instance. This allows you to use Python on the DSW instance. This topic describes how to manage third-party libraries.
Install third-party libraries
DSW provides the following development environments: Python2, Python3, PyTorch, and TensorFlow2.0. By default, third-party libraries are installed in Python3. If you want to install a third-party library in another development environment, you must manually switch to the environment where you want to install the third-party library. Format:
# Install a third-party library in Python3.
pip install --user <yourLibraryName>
# Install a third-party library in Python2.
source activate python2
pip install --user <yourLibraryName>
# Install a third-party library in TensorFlow2.0.
source activate tf2
pip install --user <yourLibraryName>
You must replace <yourLibraryName>
with the name of the third-party library that you want to install. For example, you can run the pip install --user sklearn
command to install the sklearn library.
View third-party libraries
Run the following command to view installed third-party libraries:
pip list
Uninstall third-party libraries
Run the following command to uninstall a third-party library:
pip uninstall <yourLibraryName>
You must replace <yourLibraryName>
with the name of the third-party library that you want to uninstall.
You can uninstall only the third-party libraries that are installed by yourself.
Update third-party libraries
Specific third-party libraries cannot be uninstalled. For example, tensorflow-gpu cannot be uninstalled. You can only run the update command to install a specified version of tensorflow-gpu. The specified version must be compatible with the Compute Unified Device Architecture (CUDA) version of the DSW instance that you are using. Subscription DSW instances use CUDA 10. Pay-as-you-go DSW instances use CUDA 9. Run the following command to update an installed third-party library:
pip install --upgrade --user tensorflow-gpu=<versionNumber>
You must replace <versionNumber>
with the version number of tensorflow-gpu that you want to install.
Do not upgrade pip. Otherwise, the installation may fail.