How do I import a non-standard python module in an OnDemand Jupyter Notebook

54 Views Asked by At

I am using the OnDemand service on my University HPC website to run a remote Jupyter Notebook. I have access to all the standard modules (such as numpy). But I also need to import a non-standard module that IS installed on my remote machine (in a specific conda environment) but doesn't seem to be available on the OnDemand notebook (when I try to import it).

Am I able to import the module from the correct conda environment somehow, perhaps by specifying the path of the module on my machine or something like that?

Or maybe I need to install the module again whilst I am within the OnDemand notebook?

1

There are 1 best solutions below

0
Eduardo On

Can you install packages in the OnDemand service?

You can try putting this at the top of the notebook:

! pip install {your_package}

Then add the import statement in a new cell:

import your_package

Another possibility (although it requires a few more steps) is to download the package and submit it along with your notebook.