Attention

This documentation is under active development, meaning that it can change over time as we refine it. Please email help@massive.org.au if you require assistance.

Running Miniconda on M3

Miniconda allows you to manage multiple Python environments with conda.

Miniconda is our preferred Python install method on M3 because:

  • We provide a user-friendly script to install your own copy of Miniconda on M3, minimising installation difficulty.

  • Installing Miniconda using our script automatically creates an environment called jupyterlab which can be used with the JupyterLab option in Strudel2.

  • Miniconda installs a reduced set of initial packages, ensuring you only install packages you intend to use.

Using our Miniconda install script also ensures that if you need any assistance, our team has more clarity on how best to help.

Instructions for Miniconda on M3

Install Miniconda

Our install script will install Miniconda to your default project /scratch space, i.e. /scratch/nq46/username/miniconda. You can also specify a location to install Miniconda if you prefer.

your/install/location represents the location you are installing Miniconda to. myPythonEnv represents the name of your environment

To install Miniconda, run the following commands.

module load conda-install

# To install Miniconda to your default projects /scratch space:
conda-install

# To install Miniconda somewhere else:
conda-install your/install/location

You now have your own Miniconda installation on M3 - take note of where you installed it.

Creating and activating your conda environment

When you’re ready to use your Miniconda environment, you will need to activate it with the following commands:

# To activate your Miniconda environment
source your/install/location/miniconda/bin/activate

You will notice that when conda is activated, (base) will appear in the command prompt. For example:

(base) [user@m3-login]$

This is your base Miniconda environment. To create and activate Python environments within Miniconda, run the following commands:

# To create your environment
# Change myPythonEnv to your environment name
conda create --name myPythonEnv python=3.6

# To create your environment using an environment yaml file
# Change myPythonEnv to your environment name
# Change environment.yml to your yaml file name
conda env create --name myPythonEnv -f environment.yml

# To activate your environment: ensure Miniconda is activated first such that (base) appears in the command prompt
# Change myPythonEnv to your environment name.
conda activate myPythonEnv

You will notice (base) will change to (myPythonEnv) in the command prompt. For example:

(myPythonEnv) [user@m3-login]$

You can now install Python packages into your environment as desired. The environment jupyterlab is installed with Miniconda by default, to be used with Strudel2.

You need to source activate every time you start a new shell in order to use your conda environment or install packages.

Installing and updating Python packages in your conda environment

Check that your environment is activated by ensuring (myPythonEnv) appears on the left hand side of the command prompt.

Use the following sample commands to install or update packages in conda.

# To install packages to your conda environment
conda install packageName
# To install a specific version of a package to your conda environment
conda install packageName=versionNumber

# To update a package in your conda environment to the newest version
conda update packageName
# To update a package in your conda environment to a specific version
conda update packageName=versionNumber

You can find other conda commands in this conda cheat sheet.

Deactivating your conda environment

To stop using Miniconda, first you will need to deactivate the environment you’re using by running:

conda deactivate

You will notice the command prompt still displays (base), indicating Miniconda is still activated. You can now activate another environment if you wish. To stop using Miniconda completely, deactivate it again with:

conda deactivate

The command prompt will stop displaying (base), indicating that you have completely deactivated Miniconda. You can reactivate it by following the steps for creating and activating your conda environment.

Troubleshooting

You can find other conda commands in this conda cheat sheet.

If you encounter any problems when installing or using Miniconda, refer to our FAQs as you may be able to resolve them independently. If you are unable to resolve your problem or wish to give feedback on these instructions, please contact us at help@massive.org.au.