This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
other:python:starting [2022/01/04 20:47] jypeter Added LSCE jupyterhub section |
other:python:starting [2022/08/11 12:10] jypeter [LSCE distribution] Updated the example |
||
---|---|---|---|
Line 126: | Line 126: | ||
===== Using the LSCE jupyterhub server ===== | ===== Using the LSCE jupyterhub server ===== | ||
+ | The [[https://intranet.lsce.ipsl.fr/informatique/en/jupyter/index.php|LSCE jupyterhub notebook server]] is available for users with a LSCE Linux account: | ||
+ | * from a computer on the LSCE wired network: https://jupyter.lsce.ipsl.fr/ | ||
+ | * from other computers: start the [[https://intranet.lsce.ipsl.fr/informatique/fr/vpn-forticlient.php#vpnlsce|LSCE VPN]] before opening https://jupyter.lsce.ipsl.fr/ | ||
+ | |||
+ | ==== Using a non-standard kernel ==== | ||
+ | |||
+ | Note: a //kernel// is a specific python environment/distribution | ||
+ | |||
+ | The LSCE jupyterhub server can be used to open //Notebooks// using pre-configured Python or R //kernels//. It is also possible to define additional per-user kernels by adding [[https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernel-specs|kernel configuration directories]] in the user's home directory | ||
+ | |||
+ | The steps below show how to add a specific [[other:python:starting#cdat|CDAT environment]] kernel, but can be easily adapted for using other kernels | ||
+ | |||
+ | - Initialize your (favorite) Python environment in a terminal, and (as usual) check which Python executable you are using\\ <code> >which python | ||
+ | /usr/bin/python | ||
+ | |||
+ | >source ~jypeter/.conda3_21-02_jyp.csh | ||
+ | >conda activate cdatm_py3 | ||
+ | |||
+ | (cdatm_py3) >which python | ||
+ | /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3/bin/python</code> | ||
+ | - Determine where the kernel configuration files of the **active** python are located\\ <code> >jupyter kernelspec list | ||
+ | Available kernels: | ||
+ | python3 /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_nompi_py3/share/jupyter/kernels/python3</code> | ||
+ | - Copy the existing kernel directory that you have found to your home directory. You can use the existing kernel name, or use a new kernel name (using only ASCII letters, numbers, ''-'' hyphen, ''.'' period and ''_'' underscore)\\ <code> >cp -pr /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_nompi_py3/share/jupyter/kernels/python3 ~/.local/share/jupyter/kernels | ||
+ | >cp -pr /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_nompi_py3/share/jupyter/kernels/python3 ~/.local/share/jupyter/kernels/my_favorite_kernel | ||
+ | |||
+ | >ls ~/.local/share/jupyter/kernels/ | ||
+ | my_favorite_kernel/ python3/ | ||
+ | </code> | ||
+ | - Check that the ''kernelspec list'' command now finds the new kernel(s)\\ <code> >jupyter kernelspec list | ||
+ | Available kernels: | ||
+ | my_favorite_kernel your_home_dir/.local/share/jupyter/kernels/my_favorite_kernel | ||
+ | python3 your_home_dir/.local/share/jupyter/kernels/python3</code> | ||
+ | - You can optionally change the value of the ''display_name'' parameter in the ''kernel.json'' configuration file if you want to customize the name that will appear in the jupyterhub kernel menus\\ <code> >ls your_home_dir/.local/share/jupyter/kernels/my_favorite_kernel | ||
+ | kernel.json logo-32x32.png logo-64x64.png | ||
+ | |||
+ | >cat your_home_dir/.local/share/jupyter/kernels/my_favorite_kernel/kernel.json | ||
+ | { | ||
+ | "argv": [ | ||
+ | "/home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_nompi_py3/bin/python", | ||
+ | "-m", | ||
+ | "ipykernel_launcher", | ||
+ | "-f", | ||
+ | "{connection_file}" | ||
+ | ], | ||
+ | "display_name": "My favorite Python kernel", | ||
+ | "language": "python" | ||
+ | </code> | ||
+ | - refresh the https://jupyter.lsce.ipsl.fr/ page and the new kernel(s) should appear in the kernels' related menus | ||
===== Python distributions available for LSCE users ===== | ===== Python distributions available for LSCE users ===== | ||
Line 142: | Line 191: | ||
<code> | <code> | ||
- | > module avail | + | $ module -t avail |
[...] | [...] | ||
- | 4ARTIC/3.6 grib_api/1.14 netcdf/3 python/2.7.5 | + | python/2.7 |
- | batch_env grib_api/1.14.0 netcdf/4 python/3.6 | + | python/2.7.5 |
- | [...] | + | python/2-ramces |
- | glost/0.3.1 ncview/2.1.7 python/2.7 | + | python/3 |
+ | python/3.9 | ||
+ | python/4artic | ||
+ | python/esmpy | ||
+ | python/intel | ||
[...] | [...] | ||
- | > module load python/2.7 | + | $ module load python/3.9 |
- | > which python | + | $ which python |
- | /usr/local/install/python-2.7/bin/python | + | /usr/local/install/python-3.9/bin/python |
- | > python | + | $ python |
- | Python 2.7.15 |Anaconda, Inc.| (default, Oct 10 2018, 21:32:13) | + | Python 3.9.7 (default, Sep 16 2021, 13:09:58) |
- | [GCC 7.3.0] on linux2 | + | [GCC 7.5.0] :: Anaconda, Inc. on linux |
Type "help", "copyright", "credits" or "license" for more information. | Type "help", "copyright", "credits" or "license" for more information. | ||
>>> | >>> | ||
Line 244: | Line 297: | ||
==== Anaconda ==== | ==== Anaconda ==== | ||
- | <note tip>This is the recommended Python distribution/environment. It is **available for Windows, Mac and Linux**</note> | + | <note tip>This is the recommended (by JYP) Python distribution/environment. It is **available for Windows, Mac and Linux**</note> |
- | [[https://www.continuum.io/why-anaconda|Anaconda]] is a distribution provided by [[https://www.continuum.io/|Continuum Analytics]]. It is similar to [[#enthought_deployment_manager_edm|EDM]] | + | The [[https://www.anaconda.com/products/distribution|Anaconda distribution]] is provided by the [[https://www.anaconda.com/about-us|Anaconda]] company (that was [[https://www.anaconda.com/blog/continuum-analytics-officially-becomes-anaconda|previously called Continuum Analytics]]). It is similar to [[#enthought_deployment_manager_edm|EDM]], but probably more widely used than EDM |