Using Python Packages on the HPC

You’ve probably been setup on the HPC now and you’ve submitted a few jobs, but you notice you need some special packages to get your python code up-to-snuff. Fear not, its very easy! In this blog entry we’ll dive into running custom python packages with some quick and easy code examples to get you on your way.

You do not have sudo permission on the HPC cluster, and you should not ever execute code directly without using the submit command. You do, however, have full control over your user directory (~ or /mnt/HpcStor/home/unityID) and it is persistent across all of the HPC worker nodes. Any executables, packages, or code you store in your home directory is available to all of the HPC jobs you submit. Specifically, python packages are installed via the pip utility. You can install any available package using the --user flag for pip, which points all packages to your user directory. From here, you can install specific versions and packages to utilize in your code. As an example, the following code will install the glances package into my user directory:

pip install --user glances

When working with python, be sure to know if you’re working with Python2, or Python3. pip installs packages for Python2 and pip3 installs packages for Python3.

Leave a Reply