This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
other:python:starting [2022/08/11 12:36] jypeter [ipython notebook] Improved |
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 2019, 04: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.8 | packaged by conda-forge | (default, Feb 20 2021, 16: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 236: | 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 |