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
Next revision Both sides next revision
other:python:starting [2017/03/09 16:23]
jypeter Improved the conda section
other:python:starting [2019/04/25 11:57]
jypeter
Line 5: Line 5:
 You can then read the [[jyp_steps|JYP'​s recommended steps for learning python]] for really working with python You can then read the [[jyp_steps|JYP'​s recommended steps for learning python]] for really working with python
 </​note>​ </​note>​
 +
 +Note: the former and **outdated** version (before the massive usage of //conda//) is still [[other:​python:​starting_170810|available for reference]]
  
 ===== Where to start ===== ===== Where to start =====
Line 10: Line 12:
 In order to start working with Python, you need to have a //Python distribution//​ installed on your local computer or on the remote Linux server(s) you work on. A //​distribution//​ provides a //Python interpreter//,​ and Python extensions (aka Python //modules// or //​packages//​). You may have several distributions installed on your computer and you need to know how to initialize them, and which one you are using at a given time (type ''​which python''​ on Linux to determine where the python executable is located) In order to start working with Python, you need to have a //Python distribution//​ installed on your local computer or on the remote Linux server(s) you work on. A //​distribution//​ provides a //Python interpreter//,​ and Python extensions (aka Python //modules// or //​packages//​). You may have several distributions installed on your computer and you need to know how to initialize them, and which one you are using at a given time (type ''​which python''​ on Linux to determine where the python executable is located)
  
-If you are using a Linux computer or a Mac, you should already have a **default python** installed. The following example shows where the python interpreter is installed on the //asterix// LSCE server ​(if it's in ''/​usr/​bin'',​ it's the default python) and which version it is (example below: version //2.6.6// compiled in May 2015)+If you are using a Linux computer or a Mac, you should already have a **default python** installed. The following example shows where the python interpreter is installed on the //obelix// LSCE servers ​(if it's in ''/​usr/​bin'',​ it's the default python) and which version it is (example below: version //2.7.5// compiled in April 2019)
  
 <​code>#​ Which is the current python (e.g. where is it located)? <​code>#​ Which is the current python (e.g. where is it located)?
Line 18: Line 20:
 # Where is it coming from ('​rpm'​ works on a RedHat-like Linux machine)? # Where is it coming from ('​rpm'​ works on a RedHat-like Linux machine)?
  > rpm -qf /​usr/​bin/​python  > rpm -qf /​usr/​bin/​python
-python-2.6.6-64.el6.x86_64+python-2.7.5-77.el7_6.x86_64
  
 # You also get some information when you start the interpreter # You also get some information when you start the interpreter
  > python  > python
-Python 2.6.(r266:84292May 22 201508:34:51+Python 2.7.(defaultApr  9 201914:30:50
-[GCC 4.4.7 20120313 ​(Red Hat 4.4.7-15)] on linux2+[GCC 4.8.5 20150623 ​(Red Hat 4.8.5-36)] on linux2
 Type "​help",​ "​copyright",​ "​credits"​ or "​license"​ for more information. Type "​help",​ "​copyright",​ "​credits"​ or "​license"​ for more information.
 >>>​ >>>​
Line 30: Line 32:
 ===== Python distributions available for LSCE users ===== ===== Python distributions available for LSCE users =====
  
-This section will help you choose a distribution in the big Python ecosystem (many distributions,​ python version 2.7.* or 3.*, ...). You should use a distribution that is already available near your data (e.g. do the computation on a server near your data, do not move/​duplicate the data!) and try to identify who is maintaining it, if you need help or extra packages.+This section will help you choose a distribution in the big Python ecosystem (many distributions,​ python version 2.7.* or 3.*, ...) on some of the servers used by LSCE users. You should use a distribution that is already available near your data (e.g. do the computation on a server near your data, do not move/​duplicate the data!) and try to identify who is maintaining it, if you need help or additional ​packages.
  
-Only install a distribution yourself if you need it on your local computer, or if you need to install some modules that can't be installed by the contacts listed below. A python distribution ​can require several Gb of disk space, so do not install it in a backed up //home// directory!+Only install a distribution yourself if you need it on your local computer ​(desktop or laptop), or if you need to install some modules that can't be installed by the contacts listed below. A python distribution ​will require several Gb of disk space, so do not install it in a backed up //home// directory!
  
-We suggest that you **use Python 2 rather than Python 3**Or you can check the [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​python:​jyp_steps#​python_27_vs_python_3|differences between both versions]] and try to write scripts that will work in both versions! ​8-)+You can use either //Python 2// or //Python 3//Most packages are now available in both versions, but you should make sure that the most important package/s you need is/are available in the selected Python version. You can check the [[https://​wiki.lsce.ipsl.fr/​pmip3/​doku.php/​other:​python:​jyp_steps#​python_27_vs_python_3|differences between both versions]] and try to write scripts that will work in both versions!
  
 ==== LSCE distribution ==== ==== LSCE distribution ====
  
 Contact: the LSCE system administrators ([[help-lsce@lsce.ipsl.fr]]) Contact: the LSCE system administrators ([[help-lsce@lsce.ipsl.fr]])
 +
 +Where: //obelix// interactive servers and cluster at LSCE
 +
 +Initialization type: [[other:​newppl:​starting#​using_module_to_access_optional_programs|module based]] + //conda//
 +
 +What's installed: type ''​conda list''​ after initializing the conda distribution
  
 <​code>​ <​code>​
  > module avail  > module avail
 [...] [...]
-castem/12        ferret/6.9.5     hdf5/1.8.9       netcdf/4p        ​python/​2.7.5 ​    sun-java/7.0.45+4ARTIC/3.6         ​grib_api/1.14      ​netcdf/3           python/​2.7.5 
 +batch_env ​         grib_api/1.14.0    ​netcdf/​4 ​          ​python/​3.
 +[...] 
 +glost/​0.3.1 ​       ncview/​2.1.7 ​      ​python/​2.7
 [...] [...]
  
- > module load python/2.7.5+ > module load python/2.7
  
  > which python  > which python
-/​usr/​local/​install/​python-2.7.5/bin/python+/​usr/​local/​install/​python-2.7/​bin/​python
  
  > python  > python
-Python 2.7.(default, ​Sep 18 201315:47:43+Python 2.7.15 |Anaconda, Inc.| (default, ​Oct 10 201821:32:13
-[GCC 4.4.20120313 (Red Hat 4.4.7-3)] on linux2+[GCC 7.3.0] on linux2
 Type "​help",​ "​copyright",​ "​credits"​ or "​license"​ for more information. Type "​help",​ "​copyright",​ "​credits"​ or "​license"​ for more information.
 >>>​ >>>​
Line 61: Line 72:
  
 Contact: the TGCC hotline ([[hotline.tgcc@cea.fr]]) Contact: the TGCC hotline ([[hotline.tgcc@cea.fr]])
 +
 +Where: CEA TGCC
 +
 +Initialization type: [[other:​newppl:​starting#​using_module_to_access_optional_programs|module based]]
 +
 +What's installed: ​
  
 <​code>​ <​code>​
Line 147: Line 164:
 ^  Server ​ ^  Line to add to ''​.bashrc'' ​ ^ ^  Server ​ ^  Line to add to ''​.bashrc'' ​ ^
 |  **LSCE** ​ | ''​source ~jypeter/​.conda_jyp.sh''​\\ \\ Note:{{ :​other:​python:​conda_jyp.txt |conda_jyp}} content | |  **LSCE** ​ | ''​source ~jypeter/​.conda_jyp.sh''​\\ \\ Note:{{ :​other:​python:​conda_jyp.txt |conda_jyp}} content |
 +|  **ciclad** ​ | ''​source ~jypmce/​.conda_jyp.sh''​ |
 +
  
 Note: when you add the specified line to your ''​bashrc''​ file, you will then always get the python supplied by conda, instead of the system'​s python, when you use ''​bash''​. If you don't like this permanent behavior, just type ''​source ~jyp_login_on_this_server/​.conda_jyp.sh''​ in the bash shell where you want to use conda+CDAT, rather than adding it to the ''​.bashrc''​ file... Note: when you add the specified line to your ''​bashrc''​ file, you will then always get the python supplied by conda, instead of the system'​s python, when you use ''​bash''​. If you don't like this permanent behavior, just type ''​source ~jyp_login_on_this_server/​.conda_jyp.sh''​ in the bash shell where you want to use conda+CDAT, rather than adding it to the ''​.bashrc''​ file...
Line 153: Line 172:
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
-When you initialize UV-CDAT, it will be available only the **current** window/​shell. In the other windows, you still get whatever your default python is. This should minimize potential side-effects+When you initialize UV-CDAT, it will be available only in the **current** window/​shell. In the other windows, you still get whatever your default python is. This should minimize potential side-effects
 </​WRAP>​ </​WRAP>​
  
Line 163: Line 182:
   - Use CDAT !   - Use CDAT !
  
-^  Server  ​^  UV-CDAT version ​ ^  Environment name\\ and activation line  ^ +^  UV-CDAT version ​ ​^ ​ Server ​ ​^ ​ Environment name\\ and activation line  ​^ ​ Packages\\ (''​conda list''​) ​ ^ 
-|  **LSCE** ​ |  [[:​other:​uvcdat:​cdat_conda:​cdat_2_8_0|2.8.0]]  |  **cdatm14**\\ ''​source activate cdatm14'' ​ |+|  [[:​other:​uvcdat:​cdat_conda:​cdat_2_8_0|2.8.0]]  ​|  **LSCE**\\ **ciclad**  ​|**cdatm14** (''​source activate cdatm14''​) ​ |  {{ :​other:​uvcdat:​cdat_conda:​conda_list_lsce_cdatm14_170310.txt |cdatm14 installed packages}} ​ | 
 +|  [[:​other:​uvcdat:​cdat_conda:​cdat_2_10|2.10]]  |  **LSCE**  ​|**cdatm15** (''​source activate ​cdatm15''​) ​ |  {{ :​other:​uvcdat:​cdat_conda:​uvcdat-2.10_list_170721.txt |cdatm14 ​installed packages}} ​ | 
 +|  **cdatm** will always point to the latest stable version ​ |||| 
 +|  //latest stable version// ​ |  **LSCE** ​ |**cdatm** (''​source activate cdatm''​) ​ |  ''​conda list'' ​ |
  
 === Older versions of UV-CDAT === === Older versions of UV-CDAT ===
other/python/starting.txt · Last modified: 2024/05/30 13:41 by jypeter