Load and run python

At UPPMAX we call the applications available via the module system modules. https://www.uppmax.uu.se/resources/software/module-system/

Load

Load latest python module by:

module load python

Check all available versions with:

module available python

Load specific version (recommendation for reproducibility) with:

module load python/X.Y.Z

Warning

  • Don’t use system-installed python/2.7.5

  • ALWAYS use python module

Why are there both python/3.X.Y and python3/3.X.Y modules?

Sometimes existing software might use python2 and there’s nothing you can do about that. In pipelines and other toolchains the different tools may together require both python2 and python3. Here’s how you handle that situation:

  • You can run two python modules at the same time if ONE of the module is python/2.X.Y and the other module is python3/3.X.Y (not python/3.X.Y).

Run

You can run a python script in the shell by:

python example.py

or, if you loaded a python3 module:

python3 example.py

You start a python session/prompt ( >>> ) by typing:

python  # or python3

#for interactive
ipython # or ipython3

Exit with <Ctrl-D>, “quit()” or ‘exit()’ in python prompt

<Ctrl-D>
quit()
exit()