There are multiple versions of Python installed on Spartan, which you can check using module spider Python.
Common packages like numpy are already installed with some versions, but may be missing from others.
- If a Python package is missing, we recommend that you install additional packages locally using pip install into a virtualenv on the login node.
Virtualenvs allow you to separate Python workspaces, allowing you to have different workspaces for different purposes. This is the recommended way of installing Python modules.
[scrosby@spartan-login2 ~]$ virtualenv ~/venvs/venv-3.10.4 created virtual environment CPython3.8.6.final.0-64 in 3721ms creator CPython3Posix(dest=/home/scrosby/venvs/venv-3.8.6, clear=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/scrosby/.local/share/virtualenv) added seed packages: pip==20.2.3, setuptools==50.3.0, wheel==0.35.1 activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
Note you only have to install the package once. You don't need to do it every time you want to use the package.
This works well for pure-python packages, but you may encounter errors for those that link to other binary packages. Alternatively, let us know, we can install it for you.
Detailed instructions are available at
/apps/examples/Python/virtualenv.md on Spartan.