Hello,
I need to run a Jupyter script, could you please suggest how can run it on HPC server? Do I need to load any module? Many thanks
Hello,
I need to run a Jupyter script, could you please suggest how can run it on HPC server? Do I need to load any module? Many thanks
This very much depends on how your HPC is set up and what format the script is in.
Mostly likely you will need a python installation that has the jupyter package installed in it.
If the script is an ipynb
file, once you have jupyter installed, running the script is easy. The command to run the script is is, strangely, nbconvert
.
jupyter nbconvert --to notebook --execute mynotebook.ipynb
You would wrap that in what ever submission script you would normally use with your HPC system. For example:
[USER@login1]$ cat submission.sh
#!/bin/bash
#SBATCH --nodes=1
srun jupyter nbconvert --to notebook --execute mynotebook.ipynb
[USER@login1]$ sbatch submission.sh
(disclaimer: I am not a regular SLURM user)
So the hard bit is getting jupyter installed on your HPC system. Almost all HPCs have systems for installing python packages without the need for root permissions, but the route varies from system to system (this is independent of the scheduller - SLURM in this case).
Our system uses conda to manage package installation. You would first need to create an environment with jupyter installed so you would want to do something like:
module load conda
conda create -n jupyter-env python=3 jupyter
You would also need to install any packages that the notebook required as well. Then you would need to load the env in batch submission script, so your script might look like:
[USER@login1]$ cat submission.sh
#!/bin/bash
#SBATCH --nodes=1
module load conda
source activate jupyter-env
srun jupyter nbconvert --to notebook --execute mynotebook.ipynb
Other systems might rely on pip and/or virtualenv. In pip you might try
[USER@login1]$ pip install jupyter --user
I'm working on an open-source framework that allows you to execute notebooks in SLURM.
If you need help, feel free to ping us in our community.
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Hi @i.sudbery
Thanks for your detail response. I was able to install Jupyter on the server but while running script it shows the error? I have attached the script, could it be possible to convert it as python script? Thank you so much for your time and help.
Many thanks
This should work fine as a script with the excpetion of the lines
which can be removed
and
This shell command should be replaced with the equivalent python command. Try a google search for "python delete directory".
Hi @i.sudbery,
thanks, but this line also shows the error and not sure what command to use to unzip the file in python?
Many thanks,
There is not python equivalent for unzipping a file as far as I'm aware (I might be wrong). You will need to run a shell command from python.
Hi,
Now jupyter installed on the server and I am using below jupyter code to plot the rarefaction plot but I am still getting some error. could you please suggest how I can get rid of it?
many thanks
Now jupyter installed on server but still getting en error/