This is an old revision of the document!
conda
available on your computer, and then you can use conda
to install and update more stuff.default
channel (or repository) provided by the conda repository. It's not useful because we will be mostly using (the same) packages provided by the conda-forge channel.The steps on this page are adapted from the much older (but with lots of extra and possibly useful details) installing miniconda instructions
By Linux-like, we mean:
cd /home/scratch01/<your_login>
C:\Scratch\<your_login>
directory:cd /mnt/c/Scratch/<your_login>
wget
to download the installer:wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
(90 Mb, 26 Feb 2021)bash Miniconda3-latest-Linux-x86_64.sh
Do you wish the installer to initialize Miniconda3 by running conda init? [yes|no]
⇒ NO/home/share/unix_files/cdat/miniconda3
, or a miniconda3<some_version>
subdirectory of /home/share/unix_files/cdat/
/data/jypmce/cdat/miniconda3
, or a miniconda3<some_version>
sub-directory of /data/jypmce/cdat/
/home/
does not work (e.g. /mnt/h/CDAT/miniconda3
,assuming there is a H:\CDAT\
directory, does not work)/home/<your_login>/miniconda3
miniconda3
directory size is 342M> du -sh miniconda3 342M miniconda3 > cd miniconda3 > du -sh * 20M bin 0 compiler_compat 4.0K condabin 684K conda-meta 0 envs 16K etc 5.5M include 4.0K info 198M lib 12K LICENSE.txt 114M pkgs 604K share 4.0K shell 0 ssl 0 x86_64-conda_cos6-linux-gnu
source <installation_path>/miniconda3/etc/profile.d/conda.sh
source <installation_path>/miniconda3/etc/profile.d/conda.csh
conda
command, and use it to initialize the base environment$ which conda <installation_path>/miniconda3/condabin/conda $ which python /usr/bin/python $ conda activate (base) $ which python <installation_path>/miniconda3/bin/python
$ conda update --all [...]
miniconda3
directory size goes from 432 Mb to 581 Mb. This directory will keep on growing, which is the reason why you should put it on a (preferably non backed up) disk where you have enough spaceconda
package (just in case we did not get it with the update)conda update -n base conda
rm Miniconda3-latest-Linux-x86_64.sh
The idea is to remove the miniconda3 initialization lines that were automatically added at the end of .bashrc
and put them (and other useful commands) in a special initialization file, that can be sourced only when we actually want to use conda and CDAT (in order to avoid potentiel side effects)
Note: this is the new conda activate some_version
style
See the ~jypeter/.conda3_jyp.sh
file below, and how to use it, in a bash shell. In a tcsh shell, see the ~jypeter/.conda3_jyp.csh
further down. In both shell cases, if you are installing your own version of python, you need to use your own location of the initialization files in the source
lines, and you can use another file name than conda3_jyp
$ which python /usr/bin/python $ cat ~jypeter/.conda3_jyp.sh # Conda initialization by JYP, NEW style # # Use this for working with conda and CDAT centrally managed by JYP # # Execute this file in a BASH shell with # source path/this_file # Then get the list of available python distributions with # conda env list # Then activate a specific distribution with # conda activate version_name # # More details in: # https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting#conda-based_versions_of_uv-cdat # https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:uvcdat:conda_notes # # Jean-Yves Peterschmitt - LSCE - 11/2018 source /home/share/unix_files/cdat/miniconda3/etc/profile.d/conda.sh # Use the alias below to easily determine where your python # interpreter is located alias wp="which python" # Where are ALL the python interpreters in the search path alias wpa="which -a python" # The end $ source ~jypeter/.conda3_jyp.sh $ conda activate (base) $ which python /home/share/unix_files/cdat/miniconda3/bin/python
tcsh shell usage example
>which python /usr/bin/python >cat ~jypeter/.conda3_jyp.csh # Conda initialization by JYP, NEW style # # Use this for working with conda and CDAT centrally managed by JYP # # Execute this file in a TCSH shell with # source path/this_file # Then get the list of available python distributions with # conda env list # Then activate a specific distribution with # conda activate version_name # # More details in: # https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting#conda-based_versions_of_uv-cdat # https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:uvcdat:conda_notes # # Jean-Yves Peterschmitt - LSCE - 11/2018 source /home/share/unix_files/cdat/miniconda3/etc/profile.d/conda.csh # Use the alias below to easily determine where your python # interpreter is located alias wp "which python" # The end >source ~jypeter/.conda3_jyp.csh >conda activate (base) >which python /home/share/unix_files/cdat/miniconda3/bin/python
You probably don't want to type the source line each time you need to use your conda based python, so you can add a source ~jypeter/.conda3_jyp.sh
line in your ~/.bashrc
file, and source ~jypeter/.conda3_jyp.csh
line in your ~/.cshrc
file. Then, when you need a specific python environment, just type conda activate name_of_the_specific_environment
[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]