Actions

Difference between revisions of "Python"

From Montana Tech High Performance Computing

Line 1: Line 1:
The default Python installed is 2.7.5, compiled by GCC 4.8.5.
+
The default Python installed is 2.7.5 and 3.4.10, compiled by GCC 4.8.5.
 +
We also have Miniconda3 and Anaconda3 installed so that you can create your own Python development environments. The difference between Miniconda and Anaconda is that Anaconda has a lot more numeric and scientific libraries installed by default.
 +
==Loading the anaconda or miniconda module==
 +
Once logged into HPC, you can use the module command to load the anaconda module.
 +
: <code>module load anaconda</code>
 +
For miniconda
 +
: <code>module load miniconda</code>
 +
Please note that you can only use one of the "conda" modules at a time. If you have anaonda loaded, but need to switch to miniconda, you will first need to unload the anaconda module:
 +
: <code style=display:block>module unload anaconda<br>module load miniconda</code>
 +
==Creating Anaconda or Miniconda Python environment==
 +
You can use the <code>conda create</code> command to create a new Python environment.
 +
For example, to create a Python environment named mypy38 with Python 3.8:
 +
: <code>conda create --name mypy38 python=3.8</code>
 +
You'll then be provided with the location of the environment being created and the packages will be installed. Then type ''y'' to confirm the installation.  
  
Version 3.6.4 is available by using <code>module load python/3.6.4</code>
 
  
An earlier 2.6.5 is available by using <code>module load python/2.6.5</code>
+
==Using a Python Environment in miniconda or anaconda==
 +
To get a list of available conda environment, you can use the command: <code>conda env list</code>
 +
 
 +
 
 +
 
 +
Once logged into HPC, you can use the module command to load the miniconda module.
 +
: <code>module load miniconda</code>
 +
 
 +
 
 +
 
 +
: <code style=display:block>module load anaconda</code>

Revision as of 10:46, 18 September 2020

The default Python installed is 2.7.5 and 3.4.10, compiled by GCC 4.8.5. We also have Miniconda3 and Anaconda3 installed so that you can create your own Python development environments. The difference between Miniconda and Anaconda is that Anaconda has a lot more numeric and scientific libraries installed by default.

Loading the anaconda or miniconda module

Once logged into HPC, you can use the module command to load the anaconda module.

module load anaconda

For miniconda

module load miniconda

Please note that you can only use one of the "conda" modules at a time. If you have anaonda loaded, but need to switch to miniconda, you will first need to unload the anaconda module:

module unload anaconda
module load miniconda

Creating Anaconda or Miniconda Python environment

You can use the conda create command to create a new Python environment. For example, to create a Python environment named mypy38 with Python 3.8:

conda create --name mypy38 python=3.8

You'll then be provided with the location of the environment being created and the packages will be installed. Then type y to confirm the installation.


Using a Python Environment in miniconda or anaconda

To get a list of available conda environment, you can use the command: conda env list


Once logged into HPC, you can use the module command to load the miniconda module.

module load miniconda


module load anaconda