How to install Python Packages Locally on Andromeda with Python

If needed, users are recommended to install Python packages in their own home directory. This allows users to easily switch between versions of Python libraries and applications for different projects. This also avoids potential conflicts.

You may use the ‘pip3’ command to install python packages locally.

Please use this tutorial ONLY if all of your python projects require the same set of python packages (i.e. one python environment works for all projects). Otherwise, if multiple different python environments are needed, please contact Research Service at researchservices@bc.edu to get instructions on how to install python packages locally with Anaconda.

  1. Load the python module and check the versions of ‘python’ and ‘pip3’. Make sure that python and pip are on the same version.

[johnchris@l001 ~]$ module load python
[johnchris@l001 ~]$ which python3
/usr/public/python/3.9.0/bin/python3
[johnchris@l001 ~]$ which pip3
/usr/public/python/3.9.0/bin/pip3
[johnchris@l001 ~]$

  1. Install the python package(s) you need (numpy)

[johnchris@l001 ~]$ pip3 install --user numpy
CORRECT>pip3 install numpy (y|n|e|a)? y
Defaulting to user installation because normal site-packages is not writeable Collecting numpy
……
Installing collected packages: numpy
WARNING: The scripts f2py, f2py3 and f2py3.9 are installed in '/data/cuid/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed numpy-1.23.3
WARNING: You are using pip version 20.2.3; however, version 22.2.2 is available. You should consider upgrading via the '/usr/public/python/3.9.0/bin/python3.9 -m pip install --upgrade pip' command.

  1. If needed, you can check the ‘list’ of installed packages

[johnchris@l001 ~]$ pip3 list
Package Version
---------- -------
numpy 1.23.3
pip 20.2.3
setuptools 49.2.1
WARNING: You are using pip version 20.2.3; however, version 22.2.2 is available.
You should consider upgrading via the '/usr/public/python/3.9.0/bin/python3.9 -m pip install --upgrade pip' command.

  1. To run a job on Andromeda using the set of packages you have installed locally, see the following slurm file example
Scroll to Top