PBS cannot find Python3

Hi everyone, I’m new to PBS scripting and am having trouble working with PBS on my research groups HPC cluster. Here’s my issue:

I’ve installed Python3 to my groups cluster and ran the following PBS script:


#!/bin/bash
#PBS -N TestJobArray
#PBS -j oe
#PBS -d .
#PBS -l nodes=1:ppn=1
#PBS -l mem=256MB
#PBS -l walltime=00:01:00
#PBS -t 1-4

python3 "print(getenv('PBS_ARRAY_ID'))"

I run the script using qsub <script> and four files are created, each containing the following message:


python3: command not found.


This is script is just a test for array jobs, but l need to run real code later so PBS not finding Python3 is a problem. The Python3 interpreter runs when called from the command line and it is in the right place in the filesystem so I’m thinking the Python3 installation is fine and the problem is with my PBS setup? Stackexchange and other internet searching has yielded no way to resolve this issue. Do I need to edit PBS to make Python3 ‘visible’ somehow? Any help is appreciated!

Hi!
Probably python is not installed on the nodes.
Consider to use or deploy Environment Modules on the cluster to provide software:
https://modules.readthedocs.io/en/latest/
Regards!

Hi
Login to one of youyr nodes and type:
“which python”
“which python2”
“which python3”
That will tell you the path to your installed python versions.
Depending on your distro (Debian or RH based) there might be no “python” or it might be a symlink to one of the pythons installed.

python2 and python3 will probably be in the path “/usr/bin/”. That should be on your PATH. If not, you have something wrong with your .bash_profile or .bashrc

You can also on a RH based system (which is prob what you have) do
“dnf list installed | grep python3”
which will show either python36.x86_64 or python38.x86_64 installed if you have installed Python 3.

Basically debug it first via a login to the node without the extra complication of a PBS script.

Mike

The issue was indeed not having Python3 installed to the nodes. boboshaq, speleolinu, thank you both for your help!