title = "Running JupyterLab Code (Running ipynb files) at HCC"
description = "How to run JupyterLab (ipynb) Code on HCC resources."
+++
If you are looking to run JupyterLab (ipynb Code) via HCC Slurm job, then you need to follow one of these methods:
## Method 1: Running ipynb file using the Open OnDemand JupyterLab interface
1- open your Jupyter Notebook with your written code.
2- From the **"File"** menue choose **"Save and Export Notebook As"** and select **"Executable Script"**. This step will save the Python script on your local computer.
3- Copy your exported code into HCC Swan cluster.
4- Now, you can create a SLURM submit file with the loaded system-wide kernels in your SLURM submit script.
5- Finall, you can run your Python script by adding **python test.py** in your SLURM submit script where **test.py** is the name of your Python file.
{{% notice info %}}
If you have used your custom kernel, then you will need to load the anaconda module using the command **module load anaconda** in the SLURM submit script and activate your custom conda environment as shownin https://hcc.unl.edu/docs/applications/user_software/using_anaconda_package_manager/#creating-custom-anaconda-environments.
{{% /notice %}}
## Method 2: Running ipynb file using ipython
In this method,**ipython** and **nbconvert** are required. Note that the majority of system-wide kernels already have **ipython** and **nbconvert** installed. If that is not the case, please email us at hcc-support@unl.edu..
1- Create a SLURM submit file with the loaded system-wide kernels in your SLURM submit script.
2- Now, you can run your Python script by adding **ipython -c "%run test.ipynb"** in your SLURM submit script where **test.py** is the name of your Python file.
{{% notice info %}}
If you want to use your custom kernel, then you will need to make sure **ipython** and **nbconvert** are installed in the conda environment, then you will need to load the anaconda module using the command **module load anaconda** in the SLURM submit script and activate your custom conda environment as shownin https://hcc.unl.edu/docs/applications/user_software/using_anaconda_package_manager/#creating-custom-anaconda-environments.
{{% /notice %}}
## Method 3: Running ipynb file using jupyter-nbconvert
In this method **nbconvert** is required. Note that the majority of system-wide kernels already have **nbconvert** installed. If that is not the case, please email us at hcc-support@unl.edu..
1- Create a SLURM submit file with the loaded system-wide kernels in your SLURM submit script.
2- Now, you can run your Python script by adding **jupyter-nbconvert --execute --clear-output test.ipynb** in your SLURM submit script where **test.py** is the name of your Python file.
{{% notice info %}}
If you want to use your custom kernel, then you will need to make sure **nbconvert** are installed in the conda environment, then you will need to load the anaconda module using the command **module load anaconda** in the SLURM submit script and activate your custom conda environment as shownin https://hcc.unl.edu/docs/applications/user_software/using_anaconda_package_manager/#creating-custom-anaconda-environments.