Minnesota Supercomputing Institute
3.4, 3.6.3_anaconda5.0.1, 3.5.2_anaconda4.1.1, 3.7.4_anaconda2019.10, 3.10.9_anaconda2023.03_libmamba, 3.8.3_anaconda2020.07_mamba, 3.7.1_anaconda, 3.9.3_anaconda2021.11_mamba, 3.4, 3.6.3_anaconda5.0.1, 3.5.2_anaconda4.1.1, 3.7.4_anaconda2019.10, 3.10.9_anaconda2023.03_libmamba, 3.8.3_anaconda2020.07_mamba, 3.7.1_anaconda, 3.9.3_anaconda2021.11_mamba
Tuesday, March 28, 2023
3.4, 3.6.3_anaconda5.0.1, 3.5.2_anaconda4.1.1, 3.7.4_anaconda2019.10, 3.10.9_anaconda2023.03_libmamba, 3.8.3_anaconda2020.07_mamba, 3.7.1_anaconda, 3.9.3_anaconda2021.11_mamba
Python is a high level programming language that aims to combine remarkable power with very clear syntax. Anaconda is a free cross-platform Python distribution from Continuum Analytics. It comes built in with various scientific Python packages such as NumPy, SciPy, Pandas, Matplotlib, Numba, etc.
Loading the module makes the Anaconda Python installation your default Python for all Python-related commands (python, ipython, pip).
We maintain an Anaconda environment as our recommended Python 3 environment. You will obtain this version if you type:
module load python3
To load a version of Python 2.7 that includes various accelerated tools including Pycuda, to enable GPU based computation, run:
module load python/anaconda1.7.0
General information about using Python at MSI is available on the main Python software documentation page.
Cloning an Anaconda Python Environment
In order to maintain a consistent Python environment, users are encouraged to use the conda tool available in the Anaconda Python distribution to clone the desired environment into their home directory. Anaconda Python provides the ability to clone an existing python environment using the conda tool. You can list the currently available environments with the command:
conda info --envs
The currently active environment will be indicated with an asterisk (*). In order to clone an environment, you can use the command:
mamba create --name <new_env> --clone <old_env> --path <path_to_new_env>
This will create a clone of the original environment in the specified path. You can change environments using the command:
source activate <name_of_environment>
For additional information about managing Python environments with conda, please see the documentation available at https://conda.io/docs/using/envs.html.
Note that if all you need is the conda tool, you can simply use the command:
module load conda
Other Methods for Environment Management
Python 3 makes use of virtual environments, a technology that enables the creation of multiple, lightweight, independent Python environments. Using a command like
module load python3
pyvenv --system-site-packages ~/mypython
will create a virtual environment that inherits all the capabilities of the main Anaconda installation in your home directory, where you can modify it or build your own Python modules. The command:
would then make this local Python directory your default in that terminal until you log out or type the command deactivate. With a virtual environment activated, you can easily install new or upgraded Python modules. In many cases, simply using the pip packages manager like so:
pip install --upgrade newpackage
is all that is needed.
Some add-on modules in Anaconda need a license file. The license is free for users who register on the Continuum website with their .edu address. You will receive the license file in an email that needs to be installed into the ~/.continuum directory. To obtain the license, follow instructions on the Anaconda website.