Package Managers and Adding Packages
Package Managers
Package Managers are automatically added to the Capsule Environment Editor based on the Starter Environment chosen for the Capsule. When a Custom Base Image is used, Code Ocean will automatically detect the appropriate package managers and make them available in the Environment Editor.
Every Code Ocean Recommended Starter Environment includes apt-get, the command–line tool for working with APT (Advanced Package Tool) software packages, as it is generally the preferred way to install packages in Linux distributions.
Adding Packages
After you choose the Starter Environment, you can add packages using the package managers to further establish your computational environment. When adding a package without a version number, the system will download the latest version of the package.

Pip supports installing from various version control systems, like git. The supported schemes are git+file, git+https, and git+ssh. Using this format, you can provide a URL to install a private package. It is also possible to specify a “git ref” such as branch name, a commit hash or a tag name:
MyProject @ git+https://git.example.com/MyProject.git@master
MyProject @ git+https://git.example.com/[email protected]
MyProject @ git+https://git.example.com/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709
MyProject @ git+https://git.example.com/MyProject.git@refs/pull/123/headWhen passing a commit hash, specifying a full hash is preferable to a partial hash because a full hash allows pip to operate more efficiently (e.g. by making fewer network calls).
Auto Complete Package Names
Each package manager contains a dropdown list of common packages which will automatically begin completing when you begin typing a package in the field.

Advanced Settings for Package Managers
Configure Package Managers
Some packages require specific configurations for installation, for example, configuring the Bioconda channel for the Conda or Mamba package managers.
Click the gear icon (
) next to the package manager. Select Configure [package manager name].
Enter the information for the additional setting.

Reset Package Versions to "Latest"
This affects all packages installed via the chosen package manager and allows you to install the latest version of all packages in bulk. Instead of removing each version, you can use this feature to do it all at once.
Click the gear icon (
) next to the package manager. Select Reset package versions to 'latest'.

There is no confirmation message for this action. Use it with caution.
A preferred practice is to commit changes before resetting all of the package versions in the package manager so that you can revert the change.
Remove All Packages
Instead of removing the packages one by one, you can remove all packages installed via a specific package manager in bulk.
Click the gear icon (
) next to the relevant package manager. Select Remove all packages.

There is no confirmation message for this action. Use it with caution.
A preferred practice is to commit changes before removing all the packages in the package manager so that you can revert the change.
The removal will fail if the package is currently used by another package manager. Note that there will be no pop-up message to indicate this issue.
Edit Bulk Packages
This feature is useful when you want to add, change, or remove multiple packages in bulk. You can drag and drop supported file types (i.e. requirement.txt for pip or environment.yml for conda) to add multiple packages or even just copy and paste a list of packages.
Click the gear icon (
) next to the relevant package manager.Select Edit Bulk.
A text editor will appear with the currently listed packages of that package manager. You can drag and drop the dependency files directly to the text editor window, and modify multiple packages at once. Click Save when you are done editing.

If you try to add a non-supported file type to the package manager, the system will return an error message.
Install Packages from Dependency Files in the Capsule
You can populate packages in your Capsule environment directly from the most common dependency files:
requirements.txt- pip package installer environment fileenvironment.yml- conda package installer environment filelock.json- R CRAN package installer environment file
To install packages from a dependency file:
Navigate to the dependency file in the Capsule's File Tree
Click the menu arrow (
)Select Install packages
The name and the file type have to be the same as the list above. Otherwise, the option to Install packages won't show up in the drop-down menu

Using Post-Install Script to Install Complex Packages
Some packages may require building from source or downloading files. In this case, it is better to install them via the Post-Install script. To learn more about the Post-Install, visit the Post-Install Script Guide.
Was this helpful?