User Tools

Site Tools


other:python:starting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
other:python:starting [2022/01/04 22:06]
jypeter [Using the LSCE jupyterhub server] Added user kernel definition
other:python:starting [2023/05/17 08:10] (current)
jypeter [Using a non-standard kernel] Added mkdir to create the kernels directory
Line 40: Line 40:
       * In a //bash// shell: ''​source ~jypeter/​.conda3_jyp.sh''​       * In a //bash// shell: ''​source ~jypeter/​.conda3_jyp.sh''​
       * In a //tcsh// shell: ''​source ~jypeter/​.conda3_jyp.csh''​       * In a //tcsh// shell: ''​source ~jypeter/​.conda3_jyp.csh''​
-    - Choose which //flavor// of Python ​you want by typing the activation command: +    - Choose which environment ​you want by typing the activation command:
-      * Python 2.7.x: ''​conda activate cdatm_py2''​+
       * Python 3.x: ''​conda activate cdatm_py3''​       * Python 3.x: ''​conda activate cdatm_py3''​
 +      * You can use ''​conda env list''​ to find out which environments are available, but the one you most likely want is ''​cdatm_py3''​
 +    - If you need an (older) Python 2.7 environment,​ replace the steps above with:
 +      * ''​source ~jypeter/​.conda3_19-06_jyp.sh''​
 +      * ''​conda activate cdatm_py2''​
     - Type ''​python''​ to start the interpreter     - Type ''​python''​ to start the interpreter
 +    - If you need a list of the installed packages (and their version), use
 +      * ''​conda list''​
 +      * A partial list of what is installed is available in the [[other:​uvcdat:​cdat_conda:​cdat_8_2_1#​extra_packages_list|Extra packages list]]
     - Note: if you will have to use python regularly, you should add the ''​source''​ line above to your ''​.cshrc''​ /''​.login''​ file (//tcsh// users) or ''​.bashrc''/''​.profile''​ (//bash// users)     - Note: if you will have to use python regularly, you should add the ''​source''​ line above to your ''​.cshrc''​ /''​.login''​ file (//tcsh// users) or ''​.bashrc''/''​.profile''​ (//bash// users)
       * **Do not** add the ''​conda activate cdatm_pyN''​ line to the shell config files, because this will create potential side-effects!\\ Only type the activation command in the terminal(s) where you will need to use this specific version of Python       * **Do not** add the ''​conda activate cdatm_pyN''​ line to the shell config files, because this will create potential side-effects!\\ Only type the activation command in the terminal(s) where you will need to use this specific version of Python
Line 50: Line 56:
  
 <​code>​ >ssh obelix <​code>​ >ssh obelix
-Last login: ​Mon Jun  3 08:49:53 2019 from somewhere+Last login: ​Wed Feb  1 09:56:29 2023 from somewhere 
 bash-4.2$ which python bash-4.2$ which python
 /​usr/​bin/​python /​usr/​bin/​python
 +
 bash-4.2$ source ~jypeter/​.conda3_jyp.sh bash-4.2$ source ~jypeter/​.conda3_jyp.sh
 +
 bash-4.2$ which python bash-4.2$ which python
 /​usr/​bin/​python /​usr/​bin/​python
-bash-4.2$ conda activate ​cdatm_py2 + 
-(cdatm_py2) bash-4.2$ which python +bash-4.2$ conda activate ​cdatm_py3 
-/​home/​share/​unix_files/​cdat/​miniconda3/envs/cdatm_py2/​bin/​python + 
-(cdatm_py2) bash-4.2$ python +(cdatm_py3) bash-4.2$ which python 
-Python ​2.7.15 | packaged by conda-forge | (default, Feb 28 201904:00:11+/​home/​share/​unix_files/​cdat/​miniconda3_21-02/envs/cdatm_py3/bin/python 
-[GCC 7.3.0] on linux2+ 
 +(cdatm_py3) bash-4.2$ python 
 +Python ​3.8.| packaged by conda-forge | (default, Feb 20 202116:22:27
 +[GCC 9.3.0] on linux
 Type "​help",​ "​copyright",​ "​credits"​ or "​license"​ for more information. Type "​help",​ "​copyright",​ "​credits"​ or "​license"​ for more information.
 >>>​ print('​hello!'​) >>>​ print('​hello!'​)
Line 149: Line 161:
 Available kernels: Available kernels:
   python3 ​    /​home/​share/​unix_files/​cdat/​miniconda3_21-02/​envs/​cdatm19_nompi_py3/​share/​jupyter/​kernels/​python3</​code>​   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+  - 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> ​>mkdir -p ~/​.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
  >​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  >​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
  
Line 191: Line 204:
  
 <​code>​ <​code>​
- > ​module avail+module ​-t avail
 [...] [...]
-4ARTIC/3.6         ​grib_api/​1.14 ​     netcdf/​3 ​          python/​2.7.5 +python/2.
-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.
 +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 201821:32:13+Python ​3.9.(default, ​Sep 16 202113: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 219: Line 236:
   * 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:​newppl:​starting#​using_module_to_access_optional_programs|module based]]+  * Initialization type: conda based
   * What's installed: type ''​conda list''​ after initializing a specific CDAT distribution   * What's installed: type ''​conda list''​ after initializing a specific CDAT distribution
  
Line 232: Line 249:
 == Initialization == == Initialization ==
  
-Read the [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​python:​starting#​ultra_quick-start_on_the_lsce_servers|Ultra quick-start on the LSCE servers]] above+Read the [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​python:​starting#​ultra_quick-start_on_the_interactive_lsce_servers|Ultra quick-start on the LSCE servers]] above
  
 Note: on the ciclad cluster, use ''​source ~jypmce/​.conda3_jyp.sh''​ to initialize conda Note: on the ciclad cluster, use ''​source ~jypmce/​.conda3_jyp.sh''​ to initialize conda
Line 290: Line 307:
 </​code>​ </​code>​
  
- 
-==== Anaconda ==== 
- 
-<note tip>This is the recommended 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]] 
- 
- 
-Note: Anaconda provides and uses ''​conda''​ for its installation. Since [[#​cdat|CDAT]] is also installed and maintained with ''​conda'',​ you can read the [[other:​uvcdat:​conda_notes|Installing and maintaining UV-CDAT with conda]] page for more information,​ even if you are not going to use CDAT 
- 
-==== Enthought Deployment Manager (EDM) ==== 
- 
-<note tip>This was previously called //Enthought Python Distribution (EPD)// and then  //Enthought Canopy//</​note>​ 
- 
-[[https://​www.enthought.com/​enthought-deployment-manager/​|Enthought Deployment Manager (EDM)]] is Enthought’s mechanism to deliver scientific software applications and development environments 
- 
-There are native installers for Windows (.msi), Mac OS X (.pkg), RHEL/Fedora (.rpm), and Debian/​Ubuntu (.deb) 
  
 ===== ipython ===== ===== ipython =====
Line 319: Line 319:
   * [[https://​damontallen.github.io/​IPython-quick-ref-sheets/​|Ipython-quick-ref-sheets]]   * [[https://​damontallen.github.io/​IPython-quick-ref-sheets/​|Ipython-quick-ref-sheets]]
  
 +
 +==== LSCE jupyter notebook server ====
 +
 +The different Python distributions available on the LSCE servers (interactive servers and cluster) can also be used on the [[https://​intranet.lsce.ipsl.fr/​informatique/​en/​jupyter/​index.php|LSCE jupyter notebook server]]:
 +  * If your computer is on the LSCE wired network
 +  * Or if you are using the [[https://​intranet.lsce.ipsl.fr/​informatique/​fr/​vpn-forticlient.php|LSCE VPN]]
 ==== ipython notebook ==== ==== ipython notebook ====
 +
 +<WRAP center round tip 60%>
 +If you want to use ipython notebooks at LSCE, you should **use the [[other:​python:​starting#​lsce_jupyter_notebook_server|LSCE notebook server]]** rather than trying to use (and probably overloading) the interactive servers!
 +</​WRAP>​
 +
  
 <note warning>​FIXME Add a link to the new notebook page</​note>​ <note warning>​FIXME Add a link to the new notebook page</​note>​
Line 325: Line 336:
 [[https://​www.dataquest.io/​blog/​jupyter-notebook-tutorial/​|Jupyter Notebook for Beginners: A Tutorial]] [[https://​www.dataquest.io/​blog/​jupyter-notebook-tutorial/​|Jupyter Notebook for Beginners: A Tutorial]]
  
-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 ''​my_notebook.ipynb''​ file and re-used later (e.g. the notebook provided in the [[other:​python:​jyp_steps#​part_1|introduction to Python, part 1]]).+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 ''​my_notebook.ipynb''​ file and re-used later (e.g. the notebook provided in the [[other:​python:​jyp_steps#​part_1|introduction to Python, part 1]]).
  
 Starting the notebook server: ''​ipython notebook''​ Starting the notebook server: ''​ipython notebook''​
  
-<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.+<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 ​server shared by many users!).+  * 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 ​an interactive ​server shared by many users!).
  
-You may want to [[other:​newppl:​starting#​determining_the_load_of_a_linux_server|use the '​top'​ command]] in order to monitor what is happening</​note>​+  * You may want to [[other:​newppl:​starting#​determining_the_load_of_a_linux_server|use the '​top'​ command]] in order to monitor what is happening ​on the interactive server where you are using your notebook server 
 +</​note>​
  
 /* standard page footer */ /* standard page footer */
other/python/starting.1641333964.txt.gz · Last modified: 2022/01/04 22:06 by jypeter