How to add dependencies to your capsule

Code Ocean's Environment & Dependencies screen presents a user-friendly and transparent interface for installing dependencies. It supports a variety of language-specific package managers, as well as APT, the Linux operating system-level package manager.

When will dependencies be installed?

The dependencies you add will be installed the next time you run your code. This installation process is triggered when you install new packages.
Installed dependencies are subsequently cached for future runs.

While your code is executing, the bottom Output pane will automatically open, allowing you to monitor progress and inspect the results of commands executed during the setup phase. 

Once the run completes (or is stopped), this output will be available in a file called SetupLog  in your results. See Monitoring and inspecting the result of the environment setup phase for more information.

Most package managers are available out of the box

This varies from language to language, i.e., pip  for Python, CRAN for R, etc. APT is with available at the outset for all capsules.

Adding a new package manager to your enviornment 

If you need a new package manager, you may be able to install it via apt-get. This will cause it to dynamically appear in your installation environment. For instance, if you install python-pip via apt-get, you can subsequently install python packages via pip :

Package versions

By default, when you install a new dependency, the 'Version' column will display 'latest.'

If you hover over a package version, a pencil icon will appear.

 Click this to change package versions. You can switch between different versions, or reset any package to 'latest'.

Some packages are pre-installed
. When you add these to the environment, you will receive a notification telling you so; the package will also have a pinned version listed. For instance, curl is generally pre-installed:

If you have any issues:

We are here to help! You can either write to or use the live chat feature on the bottom right of your screen.

Further customization options

Code Ocean also provides a more flexible Setup Script for dependencies not available through our native package managers. 

In addition to installing packages, package managers can also install additional languages. This can enable you to run analyses that require multiple languages in sequence.

Did this answer your question?