User Tools

Site Tools


other:uvcdat:cdat_conda:miniconda3_install

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:uvcdat:cdat_conda:miniconda3_install [2024/04/12 15:37]
jypeter [FIXME Using mamba instead of conda] REMOVED the old mamba section
other:uvcdat:cdat_conda:miniconda3_install [2024/04/18 09:43]
jypeter [Installing miniconda3 on a Linux-like or Windows computer]
Line 21: Line 21:
 /​path_to_miniconda/​envs/​cdatm_py3/​bin/​python /​path_to_miniconda/​envs/​cdatm_py3/​bin/​python
 </​code>​ </​code>​
-    * The //special// environment where //​Miniconda3//​ itself is installed is called ''​base''​. Note that the ''​python''​ binary of the //special// ''​base''​ environment is not located in the same directory hierarchy as the ''​python''​ of the other environments (i.e. there is no ''​envs/''​ subdirectory<​code>​$ conda activate base+    * The //special// environment where //​Miniconda3//​ itself is installed is called ''​base'' ​(it also used to be called ''​root''​). Note that the ''​python''​ binary of the //special// ''​base''​ environment is not located in the same directory hierarchy as the ''​python''​ of the other environments (i.e. there is no ''​envs/''​ subdirectory<​code>​$ conda activate base
  
 (base) $ which python (base) $ which python
Line 36: Line 36:
     * all the //​Anaconda//​ installer packages come from the ''​default''​ //channel// (or //​repository//​) provided by the [[https://​anaconda.org/​|conda repository]].\\ This is not very useful for us (and could even cause complex dependency problems later) because we will be mostly using (the same) packages provided by the [[https://​conda-forge.org/​feedstock-outputs/​|conda-forge]] //​channel//,​ **in order to avoid complex package dependency problems**.     * all the //​Anaconda//​ installer packages come from the ''​default''​ //channel// (or //​repository//​) provided by the [[https://​anaconda.org/​|conda repository]].\\ This is not very useful for us (and could even cause complex dependency problems later) because we will be mostly using (the same) packages provided by the [[https://​conda-forge.org/​feedstock-outputs/​|conda-forge]] //​channel//,​ **in order to avoid complex package dependency problems**.
  
-===== Installing miniconda3 on a Linux-like computer =====+===== Installing miniconda3 on a Linux-like ​or Windows ​computer =====
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
 By **//​Linux-like//​**,​ we mean: By **//​Linux-like//​**,​ we mean:
-  * A native ​Linux computer (or server) +  * A **Linux** desktop/​laptop 
-  * A windows ​10 computer with [[other:​win10wsl|WSL+Ubuntu installed]] +    * The installation will be used by **one** person 
-  * A Mac where you can use Linux in a terminal+  * A **Linux** ​server 
 +    * The installation will be used by **one or more** persons 
 +  * A **windows computer with [[other:​win10wsl|WSL+Ubuntu installed]]** 
 +    * You may want to use the //Pure Windows// installer, if all the packages you need are available for Windows 
 +    * The installation will be used by **one** person 
 +  * A **Mac** where you can use Linux in a terminal 
 +    * The installation will be used by **one** person
 </​WRAP>​ </​WRAP>​
  
 <WRAP center round info 60%> <WRAP center round info 60%>
-**//Pure Windows//** Note: you can also follow ​the steps listed in the [[https://​docs.anaconda.com/​free/​miniconda/#​quick-command-line-install|Windows section of "Quick command line install"​]] to install a //pure Windows// version of miniconda3, and then follow the steps listed ​in the next sections of this page.\\ We assume below that the installer is downloaded in the ''​C:​\Scratch\your_login''​ directory, and we install Miniconda3 in ''​C:​\Utils\miniconda3_2024-03''​ directory<​code>​PS C: cd C:​\Scratch\your_login+**//Pure Windows//** Note: 
 + 
 +  * Follow ​the steps just below adapted from the [[https://​docs.anaconda.com/​free/​miniconda/#​quick-command-line-install|Windows section of "Quick command line install"​]] to install a //pure Windows// version of miniconda3 
 +  * And then follow the steps in the next sections of this page. 
 + 
 +We assume below that
 +  * The Windows ​installer is downloaded in the ''​C:​\Scratch\your_login''​ directory 
 +  * We want to install Miniconda3 in the ''​C:​\Utils\miniconda3_2024-03''​ directory ​(and we have a few Gb of available space on that disk) 
 + 
 +<​code>​PS C: cd C:​\Scratch\your_login
 PS C:​\Scratch\your_login>​ curl https://​repo.anaconda.com/​miniconda/​Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe PS C:​\Scratch\your_login>​ curl https://​repo.anaconda.com/​miniconda/​Miniconda3-latest-Windows-x86_64.exe -o miniconda.exe
 PS C:​\Scratch\your_login>​ .\miniconda.exe PS C:​\Scratch\your_login>​ .\miniconda.exe
Line 332: Line 347:
 ===== Keeping Miniconda3 up-to-date ===== ===== Keeping Miniconda3 up-to-date =====
  
-  * Just type ''​conda update -n base --all''​ as shown in the [[#​updating_mini_conda|Updating (Mini)conda]] section+  * Just type ''​conda update -n base %%--%%all''​ as shown in the [[#​updating_mini_conda|Updating (Mini)conda]] section
  
   * The ''​base''​ (miniconda3) and the other environments are all independent and can be updated independently   * The ''​base''​ (miniconda3) and the other environments are all independent and can be updated independently
Line 339: Line 354:
 ===== conda resources ===== ===== conda resources =====
  
-Note: some extra details are available on the much older page //Installing and maintaining UV-CDAT with conda//​. ​You can check later the [[other:uvcdat:conda_notes#useful_conda_commands|Useful ​conda commands]], but the [[https://​docs.conda.io/​projects/​conda/​en/​latest/index.html|official ​conda documentation]] and the [[https://​docs.conda.io/​projects/​conda/​en/​latest/​user-guide/​cheatsheet.html|Cheat sheet]] are probably more up-to-date.+ 
 + 
 + 
 +==== Web sites ==== 
 + 
 +  * [[https://​docs.conda.io/​projects/​conda/​en/​stable/​|Official conda website]] 
 +    * [[https://​docs.conda.io/​projects/​conda/​en/​stable/​user-guide/​cheatsheet.html|Cheat sheet]] (2 pages, for people in a hurry) 
 +    * [[https://​docs.conda.io/​projects/​conda/​en/​stable/​commands/​|Commands'​ reference]] 
 +  * Package repositories 
 +    * [[https://​conda-forge.org/​packages/​|conda-forge]] <= recommended source of packages 
 +    * [[https://​anaconda.org/​|default]] 
 + 
 + 
 +==== Useful conda commands ==== 
 + 
 +This is just a subset of some of the commands, and a subset of their options! For a complete reference, use the [[https://​docs.conda.io/​projects/​conda/​en/​stable/​|official conda website]] 
 + 
 +  * **Get help** 
 +    * ''​conda -h''​ 
 +      * ''​conda //command// %%--%%help'':​ help for a specific //​command//​ 
 + 
 +  * **Available environments** 
 +    * ''​conda env list''​ 
 +    * The currently active environment has a "​*****"​ character on its line<​code>​(base) $ conda env list 
 +# conda environments:​ 
 +
 +base                  *  /​homedata/​jypmce/​miniconda3_2024-03</​code>​ 
 + 
 +  * **Activate** an existing environment (available in ''​conda env list''​) or **deactivate**,​ in order to go back to the default Python 
 +    * ''​conda activate existing_environment''​ 
 +      * ''​conda activate''​ (without specifying an environment name) will **activate the ''​base''​ Miniconda3 environment** 
 +    * Go back to the default Python ​available on the system 
 +      * ''​conda deactivate''​ 
 +    * You can type ''​which python''​ to determine where is the current ''​python''​ executable you are using is\\ You should **always know which Python you are using!** 
 +      * <​code>​(base) $ which python 
 +/homedata/jypmce/​miniconda3_2024-03/​bin/​python 
 + 
 +(base) $ conda deactivate 
 + 
 +$ which python 
 +/usr/bin/​python</​code>​ 
 +    * Note: //before conda ''​4.6''//,​ you had to type ''​**source** activate existing_environment''​ and ''​**source** deactivate''​ 
 + 
 +  * Get the **list of installed packages**, their version, and where they come from (e.g. ''​conda-forge'',​ ''​pip''​) 
 +    * ''​conda list [-n existing_environment]''​ 
 + 
 +  * **Create an environment** and install a few packages and their dependencies 
 +    * ''​conda create -n new_environment_name package1 package2 packageN''​ 
 + 
 +  * **Delete an environment** 
 +    * ''​conda remove -n crap_environment %%--%%all''​ 
 + 
 +  * **Find out if a package is available** on the //​conda-forge//​ channel (or other channels) 
 +    * Noteyou should always install a package with ''​conda''​ instead of ''​pip'',​ if it is available on a //conda channel// 
 +    * ''​conda search package_exact_name''​\\ ''​conda search '​*package_partial_name*'''​ 
 +      * Note''​search''​ with wildcards fails in a //tcsh// shell, as of April 2024 ([[https://​github.com/​conda/​conda/​issues/​9771|CSH install/​search fail with '​*'​ variable in an argument]]) 
 + 
 +  * **Install and remove packages**\\ Add ''​-n target_environment''​ to make changes in another environment than the active one 
 +    * ''​conda install package1 package2 packageN''​ 
 +      * ''​conda''​ should already be [[#fine-tuning_conda_to_use_only_conda-forge|configured to use conda-forge by default]] if you have read this page carefully 
 +      * Add ''​-c channel_url_or_alias''​ to install from a specific //​channel//​ 
 +    * ''​conda remove package1 package2 packageN''​ 
 + 
 +  * **Update** just ''​conda''​ (update the //conda// package, not the full Miniconda3 //base// environment) 
 +    * ''​conda update -n base conda''​ 
 + 
 +  * **Completely update an environment** (all the packages) 
 +    * ''​conda update -n existing_environment %%--%%all''​ 
 + 
 +  * **Cleaning... <wrap em>​Dangerous</​wrap>​**!\\ If you have several environments,​ ''​conda clean''​ may remove packages that are not needed in an environment, but are still used in other environments,​ and **you may end up with a broken installation...**\\ ''​conda''​ does not automatically clean the content of the ''​pkgs''​ directory!\\ Use the following to //Remove index cache, lock files, tarballs, unused cache packages, and source cache// 
 +    * ''​conda clean %%--%%all''​ 
 + 
 + 
 +==== conda, pip and virtualenv ==== 
 + 
 +  * Read the [[https://​docs.conda.io/​projects/​conda/​en/​stable/commands/#conda-vs-pip-vs-virtualenv-commands|Conda vs. pip vs. virtualenv commands]] section 
 + 
 +  * Read the [[https://​docs.conda.io/​projects/​conda/​en/​stable/​user-guide/​tasks/​manage-environments.html#​using-pip-in-an-environment|Using pip in an environment]] 
 +==== Installation history ==== 
 + 
 + 
 +===== Uninstalling Miniconda3 ===== 
 + 
 +==== Windows computer ==== 
 + 
 +Miniconda3 can be removed like a regular Windows application 
 + 
 +  * Go to the //Apps & features// panel 
 +    * ''​Start''​ => ''​Settings'' ​ => ''​Apps''​ => ''​Apps & features''​ 
 +  * Select ''​Miniconda3 py3xxxxx''​ 
 +  * Click on ''​Uninstall''​ and follow the instructions displayed by the uninstaller window\\ This will remove: 
 +    * The (very big) directory that you specified when you installed //​Miniconda3//​ 
 +    * The ''​conda''​ shortcuts from the ''​Start Menu''​ 
 + 
 +==== Linux-like computer ==== 
  
 /* standard page footer */ /* standard page footer */
other/uvcdat/cdat_conda/miniconda3_install.txt · Last modified: 2024/07/08 13:28 by jypeter