Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
stylenone

...

General Process

Info

Below demonstrates the general process for:

  • Setting up your environment to use Conda via a module load.

  • How to create a conda environment.

  • How to activate/start your environment and install packages.

  • How to then use what you’ve installed.

  • And then how to deactivate/finish using your environment.

Code Block
[]$ module purge
[]$ module load miniconda3/24.3.0
[]$ conda search python
[]$ conda create -n py_env
[]$ conda activate py_env
(py_env) []$ conda install python=3.12.4
(py_env) []$ python --version
Python 3.12.4
(py_env) []$ conda search numpy
(py_env) []$ conda install numpy
(py_env) []$ python -c "import numpy; print(numpy.__version__)"
1.26.4
(py_env) []$ conda deactivate
[]$

...

Search for Packages

Info

Conda enables you look up and search for packages and what versions are available.

Code Block
[]$ conda search python
Loading channels: done
# Name                       Version           Build  Channel
python                        2.7.13     hac47a24_15  pkgs/main
...
python                        3.12.3      h996f2a0_1  pkgs/main
python                        3.12.4      h5148396_1  pkgs/main
Info

Notice: Although Python version 2 has been deprecated, it is still used for old packages/modules/scripts. You can create a conda environment that provides this old, no longer supported version.

This is how ARCC provides this version on the cluster.

...

Create an Environment

Info

Use the create sub command to create your environment.

The -n option will create your environment (which is just a folder) in the default configured location.

Out the box, this will be under: /home/<username>/.conda/envs/

Code Block
[]$ conda create -n py_env
Channels:
 - defaults
Platform: linux-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##
  environment location: /home/salexan5/.conda/envs/py_env

Proceed ([y]/n)? y

...