Python on Research Computing Linux systems

Maintaining your own Python environments

In general we recommend that you create and manage your own Python environments using a tool called conda. By doing this, you will have complete control over the Python version, external packages, and the versions of those packages. In the research world this control can be critical for reliably reproducing results.  See Using conda to manage your own Python environments in Related Articles.

Centrally maintained Python environments

If you feel conda is unnecessary (e.g. you are just learning Python or are only using it for very simple tasks), we do have a pair of centrally maintained Python environments. These are the latest release of Anaconda for Python 2 and Python 3. See https://www.anaconda.com/distribution/ for more information.

To use the centrally maintained environments you must first enable the conda command in your shell.  You may put this into .bashrc if you want the conda command available every time you login (recommended).

$ source /optnfs/common/miniconda3/etc/profile.d/conda.sh

To activate Python 3,

$ conda activate anaconda3

To activate Python 2 (note: Python 2 is longer maintained so we strongly recommend Python 3 instead).

$ conda activate anaconda2

That's it. Now when you run python you will get the version that you have activated and you will have access to the many external packages which are included with Anaconda.

Here are some reasons NOT to use a centrally maintained environment. If you need

  • an environment that won't change unexpectedly
  • a specific version of Python
  • packages that aren't included in the Anaconda release
  • a different version of an external package

then you should create your own environment. See Using conda to manage your own Python environments in Related Articles.

Operating System Python

If you do not activate a conda environment, then when you run python you are getting the Python that is bundled with the Linux operating system. There is nothing wrong this version but we don't install extra packages for it and in Red Hat 7.x this is Python 2 which most people should be moving away from.

Other kinds of Python environments

You may already be using one of several legacy Python environments installed on our systems.  We are no longer maintaining these and do not recommend them, especially for new users or projects. Examples include anything you activate with the "module" command or the "scl" command.

If you are part of a lab, someone may have already setup shared a Python environment, probably also using conda.  We encourage this when people are working together and want to be sure they have the same version of everything.

100% helpful - 1 review

Details

Article ID: 72886
Created
Fri 3/1/19 2:03 PM
Modified
Wed 1/13/21 3:46 PM

Related Articles (4)

Conda is a little tricky when it comes to permissions in a Kerberized environment. This article describes one way to make it work.
Step by step sharing and receiving shared .ipynb (Jupyter/iPython/Colab) notebook via institutional GDrive