Open samwaseda opened 10 months ago
The NERSC computing center also has a nice how-to on this topic https://docs.nersc.gov/services/jupyter/how-to-guides/#how-to-use-a-container-to-run-a-jupyter-kernel
Be careful, if the kernel.json
file is wrongly formatted, no kernels are displayed in the Jupyter lab environment. Here is an example of a correctly formatted kernel.json
file:
{
"argv": [
"/cmmc/ptmp/janj/mambaforge/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "janj",
"language": "python",
"metadata": {
"debugger": true
},
"env": {
"PATH": "/cmmc/ptmp/janj/mambaforge/bin:${PATH}",
"CONDA_PREFIX": "/cmmc/ptmp/janj/mambaforge"
}
}
Make sure to not have module load pyiron/dev
in your bashrc. Instead do, module load pyiron/latest
.
In case of errors such as:
InvalidArchiveError("Error with archive /cmmc/u/<username>/.conda/pkgs/python-3.11.8-hab00c5b_0_cpython/.cph_tmps783dxu6/pkg-python-3.11.8-hab00c5b_0_cpython.tar.zst. You probably need to delete and re-download or re-create this file. Message from libarchive was:\n\nCan't create 'lib/python3.11/lib2to3/fixes/__pycache__/fix_ne.cpython-311.pyc'")
Run conda clean --all
and run the steps again.
This tutorial details how to create a custom conda environment on the cluster and use it for calculations:
/cmmc/ptmp/<username>
where<username>
is your username. This is to make sure you do not exceed the file limits.cd /cmmc/ptmp/<username>
conda create -p ./<envname>
(specify python version if needed)source activate <envname>
conda install -c conda-forge mamba
mamba install -c conda-forge ipykernel
python -m ipykernel install --user --name <envname>
/u/<username>/.local/share/jupyter/kernels/<envname>
kernel.json
and add:make sure to enclose it within the global
{}
<envname>
and have fun!