Python is available on the system, with the typical packages such as Numpy and SciPy. It is used by simply typing 'python' (this is version 2.6). Python 2.7 is available with 'python27'.
If you need a lot of additional packages, or some built in enhancements, or the latest python and packages, installing your own copy might be best. See below!
Anaconda Python (recommended option)
Anaconda Python is another option and lets users to install relevant packages that they need in their home directories easily. i.e. if you want another python package, you just install it straight away yourself!! Anaconda python can be downloaded from https://www.anaconda.com/download/#linux (choose Linux 64 bit). After downloading, simply run the installation script for setup in your home directory.
Copy the link address for the Linux 64-bit installer. Follow instructions in the cluster, for example (don't just copy/paste this line as it is for an older version - look at the link above):
wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh bash Anaconda3-5.2.0-Linux-x86_64.sh
Click through the installer screens and accept license terms. After it starts installing it will take a while (half an hour or so) thus it's good to start this before you head to lunch, or to class, etc..
Make sure to include the Anaconda Python in your PATH environment variable - it will ask at the end if you want to automatically do that, say yes. When it asks about " Do you wish to proceed with the installation of Microsoft VSCode?" you can just say No.
If you didn't have the installer add it to the path - or to manually do it include the following lines in your .bashrc, or .profile
You can then install many of the packages by the conda install command. For example
conda install numpy conda install scipy conda install mkl # Use Intel MKL libraries for numpy/scipy (recommended)
To run a job in the queue, you can write a simple script
#!/bin/bash #PBS -l nodes=1:ppn=1 # serial job on knot cd $PBS_O_WORKDIR python myfile.py
or on pod (in Slurm)
#!/bin/bash #SBATCH -N 1 -n 1 cd $SLURM_SUBMIT_DIR python myfile.py
An older way - notes still here if you're using it - Another option is Canopy, which includes quite a few extra packages (e.g. ipython) and provides you with a IDE. If you want to useCanopy, first run the installer which will put it in your directory by
this will actually take several minutes to do, so go do something else for a moment while it works. If you'll want to run jobs in the queue, you also need to set it up so that the Canopy python becomes your default - do this by
~/Canopy/canopy_cli setup ~/canopy --set-default
This will also take some time to process, so go get lunch while it runs. Once it is installed, you run Canopy (for the GUI) by
and if you've run the ' ~/Canopy/canopy_cli setup ~/canopy --set-default' then any time you use python, you'll be using the Canopy version (you can verify this by typing 'which python').