If your script actually needs to run on "an unpredictable system," upon which you do not have the privilege to install modules globally, then your situation becomes identical to that of installing upon "shared hosting." You need to create a local directory, put this first in
so that it will install modules into that local directory. Then, install every module that you need – and the correct versions thereof – into that place.