Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

The supercomputer uses Mamba, a high-performance parallel package manager, to allow users to install the Python modules they need. It also plays a pivotal role in optimizing software environments on supercomputers. In the upcoming instructions, we'll explore the process of loading Mamba modules and delve into creating and loading new environments.

The supercomputers use mamba instead of conda and pip. mamba is a parallel and C++ implementation of conda that provides a much faster experience for setting up Python environments on the supercomputer. If you’re familiar with using conda, all you will need to do is replace the conda command with the mamba command. pip is not stable in a multi-user environment like a supercomputer, so Research Computing discourages the use of pip except when necessary.

Be very careful with pip, it can easily break a mamba environment!

Why Create a New Environment?

In a fresh terminal session, python or python3 points to a system-installed copy of Python (typically in /usr/bin). As the operating system heavily depends on this python instance, the version is fixed and only the most basic, built-in libraries are available.

Creating a new environment allows you to have full control over the Python version, the selection of libraries, and the specific versions, too. Python environments can then be engaged and disengaged freely, enabling a wide-variety of specific uses including CPU compute and even GPU acceleration.

Load the Package and Environment Manager

Load the latest stable version of the mamba Python manager with:

module load mamba/latest

List Available Environments

Many Python suites, such as Pytorch or Qiime, are commonly-requested and thus are provided by Research Computing staff on the supercomputers already. These environments are version-fixed and read-only, so they may be used freely by any number of users simultaneously without any risk of the environment changing.

All global/admin-maintained python environments may be found under /rc/packages/envs:

$ ls /rc/packages/envs/
  pytorch-gpu-2.0.1/     scicomp/        tensorflow-gpu-2.12.1/  

User environments are by default installed to ~/.conda/envs, and after running module load mamba/latest, all available environments may be listed with mamba info --envs.

[<asurite>@login1 ~]$ mamba info --envs

          mamba version : 1.5.1
# conda environments:
#
pytorchGPU               /home/<asurite>/.conda/envs/pytorchGPU
testing                  /home/<asurite>/.conda/envs/testing
updateTest               /home/<asurite>/.conda/envs/updateTest
base                     /rc/packages/apps/mamba/1.5.1
pytorch-gpu-2.0.1        /rc/packages/envs/pytorch-gpu-2.0.1
scicomp                  /rc/packages/envs/scicomp
...

Load Available Environments

Use the source activate command to load the environment you want.

$ module load mamba/latest
$ source activate pytorch-gpu-2.0.1

The name of the environment will appear to the left of the command prompt so that you know what environment is currently active.

(pytorch-gpu-2.0.1) $ python nobel_prize.py

Environments may also be activated with a full path, e.g.,

source activate /project/sciencelab/.conda/envs/pysci.

This capability makes /project (project storage) an ideal location for groups sharing python environments!

Do not load environments with conda or mamba as the prefix, i.e., mamba activate gurobi-9.5.1, as this injects non-supercomputing friendly cruft into your supercomputing configuration files!

Creating Environments

$ module load mamba/latest
$ mamba create -n <environment_name> -c conda-forge [-c <channel>] [packages]
$ source activate <environment_name>

It is best to install all necessary packages at this step, as it maximizes environment stability and minimizes total build time to have all major dependencies resolved initially.

Environments may also be created by specifying the path, but be careful as creating environments in non-default locations makes it easy to lose the environment!

conda-forge is the only available channel on Aloe. Other channels are blocked.

When using mamba to install packages or create environments, you may see errors related to opening files in /packages/apps/mamba. These errors are harmless. An example is shown below.

Always verify the Prefix: is pointing where you need it to before proceeding with an installation, but otherwise, errors and warnings made by mamba may be ignored.

It is also good practice to verify what is being installed as a new package, what existing packages are being modified, and what existing packages are being removed before proceeding with the install.

Please review the mamba install section below for a summary of the components of mamba install.

Adding dependencies to existing Environments

The global/admin-maintained environments are read-only and can’t be changed by users. To add packages to one of these environments, you will need to clone it.

mamba create --name <new_environment_name> --clone <environment_to_copy>

This will create an environment called <new_environment_name> that is copied from <environment_to_copy>.

To install a new package to a mamba environment, first load the mamba module, then activate the existing environment, and finally install as many new dependencies as required.

$ module load mamba/latest
$ source activate <environment_name>
$ mamba install -c conda-forge [-c <channel>] <packages>

Please review the screenshot of an example mamba install below before proceeding. Annotations are shown in cyan with a black background and cyan outline.

When using mamba to install packages or create environments, you may see errors related to opening files in /packages/apps/mamba. These errors are harmless. An example is shown below.

Always verify the Prefix: is pointing where you need it to before proceeding with an installation, but otherwise, errors and warnings made by mamba may be ignored.

It is also good practice to verify what is being installed as a new package, what existing packages are being modified, and what existing packages are being removed before proceeding with the install.

Using environments in Jupyter

Once an environment is created, a kernel interface will need to be made to have that environment available in Jupyter. This is as easy as, mkjupy <env_name>. Please review Preparing Python Environments for Jupyterfor additional details.

What if the Package I Need Isn’t in Conda-forge?

Conda-forge is the only pre-approved place to get Python modules right now. Other modules will need to go through an approval process with the KE Secure Cloud team before they can be used. Contact asre-support@asu.edu to ask for a module.

Error rendering macro 'excerpt-include' : User 'null' does not have permission to view the page 'Additional Help Excerpt'.

  • No labels