Working with packages
How to work with packages
DataCamp Workspace's cloud execution environments come pre-packaged with all the common data science and machine learning packages.
If you need additional packages, you can install these manually, but keep in mind that you will need to reinstall these packages every time you return to your workspace.
You should keep track of additional package installs at the top of your notebook, so you can easily rerun the commands when you return to your workspace and to ensure that workspace publications can complete without issues.

Python workspace

To see which packages are available in a Python workspace, run !pip freeze in a code cell. This will print out a list of all installed packages and their version.
To install additional packages, add !pip install <name-of-pkg> e.g. !pip install pythonwhat in a code cell.
If you want to suppress the output when installing additional packages, you can use %%capture in the line above the !pip command:
1
%%capture
2
!pip install PyPortfolioOpt
Copied!

R workspace

To see which packages are available in a R workspace, run installed.packages() in a code cell. This will print out a list of all installed packages and their version.
To install additional packages, add install.packages("<name-of-pkg>") e.g. install.packages("praise")in a code cell
If you want to suppress the output when installing additional packages, you can use the quiet = TRUE argument:
1
install.packages("PortfolioAnalytics", quiet = TRUE)
Copied!
You can also use suppressMessages(), suppressWarnings() and suppressPackageStartupMessages() to suppress output.