other:python:starting
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
other:python:starting [2019/06/04 18:08] – Re-ordered and improved jypeter | other:python:starting [2025/07/03 16:18] (current) – [Using a non-standard kernel] jypeter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Working with Python ====== | ====== Working with Python ====== | ||
- | <note tip>This page will tell you how to select a python distribution and start (and exit!) the python interpreter | + | <note tip>This page will tell you how to select a //python distribution// and start (and exit!) the python interpreter |
- | You can then read the [[jyp_steps|JYP' | + | After reading this page, you can read the [[jyp_steps|JYP' |
</ | </ | ||
Line 30: | Line 30: | ||
</ | </ | ||
- | ===== Ultra quick-start on the LSCE servers ===== | + | ===== Ultra quick-start on the interactive |
==== Initialization ==== | ==== Initialization ==== | ||
Line 40: | Line 40: | ||
* In a //bash// shell: '' | * In a //bash// shell: '' | ||
* In a //tcsh// shell: '' | * In a //tcsh// shell: '' | ||
- | - Choose which //flavor// of Python | + | - Choose which environment |
- | * Python 2.7.x: '' | + | |
* Python 3.x: '' | * Python 3.x: '' | ||
+ | * You can use '' | ||
+ | - If you need an (older) Python 2.7 environment, | ||
+ | * '' | ||
+ | * '' | ||
- Type '' | - Type '' | ||
+ | - If you need a list of the installed packages (and their version), use | ||
+ | * '' | ||
+ | * A partial list of what is installed is available in the [[other: | ||
- Note: if you will have to use python regularly, you should add the '' | - Note: if you will have to use python regularly, you should add the '' | ||
* **Do not** add the '' | * **Do not** add the '' | ||
Line 50: | Line 56: | ||
< | < | ||
- | Last login: | + | Last login: |
bash-4.2$ which python | bash-4.2$ which python | ||
/ | / | ||
+ | |||
bash-4.2$ source ~jypeter/ | bash-4.2$ source ~jypeter/ | ||
+ | |||
bash-4.2$ which python | bash-4.2$ which python | ||
/ | / | ||
- | bash-4.2$ conda activate | + | |
- | (cdatm_py2) bash-4.2$ which python | + | bash-4.2$ conda activate |
- | / | + | |
- | (cdatm_py2) bash-4.2$ python | + | (cdatm_py3) bash-4.2$ which python |
- | Python | + | / |
- | [GCC 7.3.0] on linux2 | + | |
+ | (cdatm_py3) bash-4.2$ python | ||
+ | Python | ||
+ | [GCC 9.3.0] on linux | ||
Type " | Type " | ||
>>> | >>> | ||
Line 123: | Line 135: | ||
- Learn Python by reading what you need on the [[other: | - Learn Python by reading what you need on the [[other: | ||
+ | |||
+ | ===== Using JupyterHub servers ===== | ||
+ | |||
+ | ==== JupyterHub servers available for LSCE users ==== | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * You will **have to** be on the LSCE wired network, or use the [[https:// | ||
+ | * Otherwise, check the IPSL server documentation, | ||
+ | |||
+ | ==== Notebooks and jupyter servers documentation ==== | ||
+ | |||
+ | FIXME | ||
+ | |||
+ | |||
+ | ==== Using a non-standard kernel ==== | ||
+ | |||
+ | Note: a //kernel// is a specific python environment/ | ||
+ | |||
+ | The LSCE jupyterhub server can be used to open // | ||
+ | |||
+ | The steps below show how to add a specific [[other: | ||
+ | |||
+ | - Initialize your (favorite) Python environment in a terminal, and (as usual) check which Python executable you are using\\ < | ||
+ | / | ||
+ | |||
+ | > | ||
+ | > | ||
+ | |||
+ | (cdatm_py3) | ||
+ | / | ||
+ | - Determine where the kernel configuration files of the **active** python are located\\ < | ||
+ | Available kernels: | ||
+ | python3 | ||
+ | - Copy the existing kernel directory that you have found to your home directory (more precisely to the '' | ||
+ | > | ||
+ | > | ||
+ | |||
+ | > | ||
+ | my_favorite_kernel/ | ||
+ | </ | ||
+ | - Check that the '' | ||
+ | Available kernels: | ||
+ | my_favorite_kernel | ||
+ | python3 | ||
+ | - You can optionally change the value of the '' | ||
+ | kernel.json | ||
+ | |||
+ | > | ||
+ | { | ||
+ | " | ||
+ | "/ | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | - Refresh the '' | ||
===== Python distributions available for LSCE users ===== | ===== Python distributions available for LSCE users ===== | ||
Line 133: | Line 207: | ||
==== LSCE distribution ==== | ==== LSCE distribution ==== | ||
- | * Contact: the LSCE system administrators | + | * Contact: the [[other: |
* Where: //obelix// interactive servers and //obelix// cluster at LSCE | * Where: //obelix// interactive servers and //obelix// cluster at LSCE | ||
* Initialization type: [[other: | * Initialization type: [[other: | ||
- | * What's installed: type '' | + | * What's installed: type '' |
< | < | ||
- | > | + | $ module avail python |
- | [...] | + | python/2.7 python/ |
- | 4ARTIC/3.6 | + | python/ |
- | batch_env | + | |
- | [...] | + | |
- | glost/ | + | |
- | [...] | + | |
- | > | + | $ module load python/3.9 |
- | > | + | $ which python |
- | / | + | / |
- | > | + | $ python |
- | Python | + | Python |
- | [GCC 7.3.0] on linux2 | + | [GCC 11.2.0] :: Anaconda, Inc. on linux |
Type " | Type " | ||
>>> | >>> | ||
Line 161: | Line 231: | ||
==== CDAT ==== | ==== CDAT ==== | ||
- | [[https://uvcdat.llnl.gov/ | + | [[https://cdat.llnl.gov/ |
CDAT is **available for Mac, Linux and Windows 10 (Windows 10 + [[other: | CDAT is **available for Mac, Linux and Windows 10 (Windows 10 + [[other: | ||
Line 167: | Line 237: | ||
* Contact: Jean-Yves Peterschmitt (//JYP//) @ LSCE | * Contact: Jean-Yves Peterschmitt (//JYP//) @ LSCE | ||
* Where: //obelix// interactive servers and cluster at LSCE, //ciclad// interactive servers and cluster at IPSL, irene @ TGCC | * Where: //obelix// interactive servers and cluster at LSCE, //ciclad// interactive servers and cluster at IPSL, irene @ TGCC | ||
- | * Initialization type: conda based or [[other: | + | * Initialization type: conda based |
* What's installed: type '' | * What's installed: type '' | ||
Line 175: | Line 245: | ||
^ CDAT version | ^ CDAT version | ||
- | | **8.1** | + | | **8.2.1** |
+ | | **8.1** | ||
== Initialization == | == Initialization == | ||
- | Read the [[https:// | + | Read the [[https:// |
Note: on the ciclad cluster, use '' | Note: on the ciclad cluster, use '' | ||
=== CDAT at TGCC === | === CDAT at TGCC === | ||
+ | |||
+ | Note: TGCC also supports its own [[# | ||
CDAT **8.0** is installed at TGCC and can be initialized with: | CDAT **8.0** is installed at TGCC and can be initialized with: | ||
Line 189: | Line 262: | ||
* Python 3: '' | * Python 3: '' | ||
- | === A common error === | + | === A common |
Note: if you get an error when importing //cdms2// or //vcs// it means that either you have forgotten to initialize CDAT, or that something went wrong during the initialization. In both cases, you are either still using the default python installed on your system, or another (non-CDAT) python distribution! | Note: if you get an error when importing //cdms2// or //vcs// it means that either you have forgotten to initialize CDAT, or that something went wrong during the initialization. In both cases, you are either still using the default python installed on your system, or another (non-CDAT) python distribution! | ||
Line 235: | Line 308: | ||
</ | </ | ||
- | ==== Canopy ==== | ||
- | |||
- | [[https:// | ||
- | |||
- | Canopy is **available for Windows, Mac and Linux**. You can download the free //Canopy Express// that will already provide many extensions. If you are entitled to use //Canopy Academic//, login from inside Canopy Express and download the extra modules you need | ||
- | |||
- | |||
- | ==== Anaconda ==== | ||
- | |||
- | [[https:// | ||
- | |||
- | Anaconda is **available for Windows, Mac and Linux** | ||
- | |||
- | Note: Anaconda provides and uses '' | ||
===== ipython ===== | ===== ipython ===== | ||
Line 261: | Line 320: | ||
* [[https:// | * [[https:// | ||
+ | |||
+ | ==== LSCE jupyter notebook server ==== | ||
+ | |||
+ | The different Python distributions available on the LSCE servers (interactive servers and cluster) can also be used on the [[https:// | ||
+ | * If your computer is on the LSCE wired network | ||
+ | * Or if you are using the [[https:// | ||
==== ipython notebook ==== | ==== ipython notebook ==== | ||
+ | |||
+ | <WRAP center round tip 60%> | ||
+ | If you want to use ipython notebooks at LSCE, you should **use the [[other: | ||
+ | </ | ||
+ | |||
<note warning> | <note warning> | ||
- | The ipython notebook is a way to interact with python (and other supported interpreted languages) inside a web browser. You can mix //cells// with python commands, cells with the output of the python commands (possibly graphics generated by the commands), and text (using some wiki-like rich text format). This interactive web page, aka notebook, can be saved in a '' | + | [[https:// |
+ | |||
+ | The **ipython notebook is a way to interact with python (and other supported interpreted languages) inside a web browser**. You can mix //cells// with python commands, cells with the output of the python commands (possibly graphics generated by the commands), and text (using some wiki-like rich text format). This interactive web page, aka notebook, can be saved in a '' | ||
Starting the notebook server: '' | Starting the notebook server: '' | ||
- | <note warning> | + | <note warning> |
+ | * **Warning!** When you start the notebook server, you will start a python process and a web browser, and a new python process will be started each time you open a new notebook. | ||
- | Please make sure that you shutdown cleanly each notebook and the server when you are finished, in order not to clutter the local computer or remote server with lots of python processes (especially | + | * Please make sure that you **shutdown cleanly each notebook and the server when you are finished**, in order not to clutter the local computer or remote server with lots of python processes (especially |
- | You may want to [[other: | + | * You may want to [[other: |
+ | </ | ||
/* standard page footer */ | /* standard page footer */ |
other/python/starting.1559664483.txt.gz · Last modified: 2019/06/04 18:08 by jypeter