...
Codeblock |
---|
module load Python/3.1110.35 |
Create a new virtual environment, e.g. in /gpfs/project/$USER, then update pip, setuptools and wheel (replace $USER with your username):
Codeblock |
---|
python -m venv --prompt py311py310 --system-site-packages /gpfs/project/$USER/py311py310 PIP_CONFIG_FILE=/software/python/pip.conf pip install --user --upgrade pip setuptools wheel |
Hint: it may be neccessary to install virtualenv as a user if this fails: PIP_CONFIG_FILE=/software/python/pip.conf pip install --user virtualenv
Activate this environment and install all packages you want to work with - at least ipykernel must be installed
Codeblock |
---|
source /gpfs/project/$USER/py311py310/bin/activate PIP_CONFIG_FILE=/software/python/pip.conf pip install ipykernel |
...
Codeblock |
---|
cd /gpfs/project/$USER/py311py310 vi kernel.sh kernel.sh ---------------------------------------------------- #!/bin/bash module load Python/3.10.5 source /gpfs/project/$USER/py311py310/bin/activate exec python -m ipykernel $@ ---------------------------------------------------- chmod a+x kernel.sh |
...
Codeblock |
---|
mkdir -p /home/$USER/.local/share/jupyter/kernels/py311py310 cd /home/$USER/.local/share/jupyter/kernels/py311py310 |
Create a new file "kernel.json" with contents
Codeblock |
---|
{ "argv": [ "/gpfs/project/$USER/py311py310/kernel.sh", "-f", "{connection_file}" ], "display_name": "Venv (py311py310)", "language": "python", "metadata": { "debugger": true } } |
...