Installations
Various versions of both Python 3.x and Python 2.x are available on Frontera through the Lmod module system, all built with a collection of third-party libraries useful for scientific computing. You probably already have a working code, and know approximately which version you need. If you are starting code development from scratch, you should work for Python 3 since version 2 is past its end-of-life. It should be noted that many systems include a built-in Python installation that is intended for system administration, and which is not augmented by all the third-party numerical libraries that one needs to carry out scientific research. That is also the case on Frontera: there is an installed version of python 2.7.5 in /usr/bin/python, but you will not want to use that for your scientific work. Instead, you will want to use one of the Python installations managed through the module system.
You can use the following command in your shell to load the module containing the default installed version of python3:
Alternatively, you can choose to load a different python3 module by seeing what is available and specifying that version explicitly in the module load command. A listing of all Python installations available on Frontera is available through the module spider command:
python3
, to distinguish it from various 2.x versions.If you want to run python3
, you will need to explicitly call it as such (or otherwise set up an alias so that you do not get the 2.x version by mistake). There are other Python-related executables in the python3 bin directory that also have a trailing "3" in their names to indicate their association with Python 3; these include: f2py3, idle3, iptest3, ipython3, pip3, pydoc3
.
Unless you are specifically trying to inspect and compare different installations at the same time, it is probably best to have only one of the relevant modules loaded at any given time, lest you become confused about what version you are working with. For example, the trailing 3's noted above are meant to distinguish 2.x from 3.x versions of various tools, but this convention is not used on all systems; so if you have both a 2.x and 3.x module loaded, you might mistakenly call pip
to install a new package, when what you really wanted was to call pip3
.
The bulk of the third-party libraries needed for scientific computing are stored in that directory. In addition, each of the Lmod Python modules manipulates the user's PYTHONPATH environment variable, to prepend a directory that points to a second version-specific site-packages directory. The full set of import directories associated with each installation can be examined by querying the sys.path
variable within the Python interpreter:
For further information on specific libraries available, see the next section on Python libraries on Frontera.