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 revisionPrevious revision
Next revision
Previous revision
other:uvcdat:cdat_conda:miniconda3_install [2024/07/04 16:28] – [Useful conda commands] Added 'conda doctor' jypeterother:uvcdat:cdat_conda:miniconda3_install [2024/08/09 17:42] (current) – Added a new "Creating Windows menu shortcuts to start environments" section jypeter
Line 124: Line 124:
       * ''Anaconda Prompt''       * ''Anaconda Prompt''
       * ''Anaconda Powershell Prompt''       * ''Anaconda Powershell Prompt''
-        * **We will now use this //Anaconda PowerShell// shortcut each time we need to use Miniconda3 or Python**+        * **We will now use this //Anaconda Powershell// shortcut each time we need to use Miniconda3 or Python** 
 +      * It is **highly recommended to [[other:win10apps#windows_terminal|install Windows Terminal and make it the default terminal application]]**, so that the ''conda'' prompts will open in a modern (and highly configurable) terminal
  
   * Remove the installer<code>PS C:\Scratch\your_login> del .\miniconda.exe</code>   * Remove the installer<code>PS C:\Scratch\your_login> del .\miniconda.exe</code>
Line 438: Line 439:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-It seems **safe** to reclaim some disk space by cleaning up the initial (//base//) installation, **when no other environments have been installed yet**\\ \\ Use cleaning with caution after installing other environments...+It seems **safe** to reclaim some disk space by cleaning up the initial (//base//) installation, **when no other (shared) environments have been installed yet**\\ \\ Use cleaning with caution after installing other environments (besides ''base''), especially environments **shared** by several usersBut it should not break your installation
 </WRAP> </WRAP>
  
-You can [[https://docs.conda.io/projects/conda/en/latest/commands/clean.html|clean]] the initial //Miniconda3// installation to free up some disk space. +  * ''conda clean %%--%%all'' 
- +    * [[https://docs.conda.io/projects/conda/en/latest/commands/clean.html|Documentation]] 
-The documentation specifies //WARNING: This will break environments with packages installed using symlinks back to the package cache.// +    * There is **no ''-n'' option to specify an environment name**, because ''clean'' will //Remove **unused** packages and caches// shared by **all** the environments 
- +      * The ''clean'' command will mostly deal with the content of the ''/path_to_miniconda/pkgs/'' directory 
-**You should probably avoid using ''clean'' once you have used //Miniconda3// to install new Python environments** (unless you are desperate for disk space, and know how to do a complete re-installation if something breaks...) +    * Example:<code>(base) $ conda clean --all
- +
-<code>(base) $ conda clean --all+
 Will remove 154 (180.9 MB) tarball(s). Will remove 154 (180.9 MB) tarball(s).
 Proceed ([y]/n)? y Proceed ([y]/n)? y
Line 463: Line 462:
 457M    /homedata/jypmce/miniconda3_2024-03 457M    /homedata/jypmce/miniconda3_2024-03
 </code> </code>
 +
 +  * It //should// be safe to use ''conda clean %%--%%all'' even in a multi-user installation with several environments, **if you don't use the ''-f'' option**
 +    * The ''-f''/''%%--%%force-pkgs-dirs'' documentation specifies //WARNING: This will break environments with packages installed using symlinks back to the package cache.//
 +      * ...but Linux installations probably use [[https://www.redhat.com/sysadmin/linking-linux-explained|hard links]] rather than soft/symbolic links
 +      * ...and you will probably never need this option anyway
 +
 +  * Remember that **your Python installation will keep on growing and growing and growing, and you will need to do some cleaning at some point**
 +
 +
 +
 ===== Initializing conda in terminals ===== ===== Initializing conda in terminals =====
  
Line 551: Line 560:
     * FIXME: update/rewrite the [[other:uvcdat:cdat_conda:cdat_2024_03]] page     * FIXME: update/rewrite the [[other:uvcdat:cdat_conda:cdat_2024_03]] page
  
 +
 +===== Creating Windows menu shortcuts to start environments =====
 +
 +FIXME => Move this section somewhere else?
 +
 +  * Use ''conda install'' and what is described in [[https://github.com/conda/menuinst/issues/246|Easily creating shortcuts with the powershell_shortcut_miniconda and console_shortcut_miniconda packages, and can this be replicated with menuinst ?]]
 +
 +  * Can theoretically be done with [[https://conda.github.io/menuinst/|menuinst]]
 +    * [[https://github.com/conda/menuinst|menuinst @ GH]]
 +
 +  * FIXME Find a way to add Windows Terminal profiles
 +    * See ''menuinst''+[[https://github.com/conda/menuinst/issues/196|Add Windows Terminal profile option]]
 ===== conda resources ===== ===== conda resources =====
  
Line 556: Line 577:
 ==== Web sites ==== ==== Web sites ====
  
-  * [[https://docs.conda.io/projects/conda/en/stable/|Official conda website]]+  * [[https://docs.conda.io/projects/conda/en/stable/|Official Documentation site]]
     * [[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/user-guide/cheatsheet.html|Cheat sheet]] (2 pages, for people in a hurry)
     * [[https://docs.conda.io/projects/conda/en/stable/commands/|Commands' reference]]     * [[https://docs.conda.io/projects/conda/en/stable/commands/|Commands' reference]]
 +    * [[https://docs.conda.io/projects/conda-build/en/stable/resources/package-spec.html#conda-package-specification|Conda package specification]]
 +      * This helps understand (and [[https://github.com/conda/conda/issues/14026|use]]) the content of the ''/path_to_miniconda/pkgs'' directory
 +
 +  * [[https://conda.org/blog/|conda community site]]:
 +    * [[https://conda.org/blog/|conda Blog]]: ''conda'' new features, etc...
 +
 +  * [[https://github.com/conda/conda|conda @ GitHub]]
 +
   * Package repositories   * Package repositories
     * [[https://conda-forge.org/packages/|conda-forge]] <= recommended source of packages     * [[https://conda-forge.org/packages/|conda-forge]] <= recommended source of packages
Line 653: Line 682:
     * **Specific versions can be specified** by using the [[#the_conda_matchspec_format|conda MatchSpec format]]     * **Specific versions can be specified** by using the [[#the_conda_matchspec_format|conda MatchSpec format]]
     * ''conda remove package1 package2 packageN''     * ''conda remove package1 package2 packageN''
- +    Matching ''pip'' commands (**only** if the package is not available in conda!) 
-  Display the **dependencies of a package**, and the **packages that need a specific packages** +      * ''pip install package'' 
-    e.g. the ''requests'' package+      * ''pip uninstall package''
  
   * **Update a package** in the current, or a specific environment   * **Update a package** in the current, or a specific environment
     * ''conda update -n existing_environment installed_package''     * ''conda update -n existing_environment installed_package''
-    * Update only the ''conda'' package (not the full Miniconda3 //base// environment) in the ''base'' environment\\ ''conda update -n base conda''+    * Update only the ''conda'' package (not the full Miniconda3 //base// environment) in the ''base'' environment 
 +      * ''conda update -n base conda'' 
 +      * Changes and new ''conda'' features are detailed in the [[https://conda.org/blog/|conda Blog]] 
 +    * Matching ''pip'' command (**only** if the package is not available in conda!) 
 +      * ''pip install %%--%%upgrade package''
  
   * **Completely update an environment** (i.e. update **all** the packages)   * **Completely update an environment** (i.e. update **all** the packages)
Line 669: Line 702:
       * Note: ''mamba repoquery'' currently [[https://github.com/mamba-org/mamba/issues/3334|only works in the currently active environment]]       * Note: ''mamba repoquery'' currently [[https://github.com/mamba-org/mamba/issues/3334|only works in the currently active environment]]
     * It can be useful to determine:     * It can be useful to determine:
-      * the packages that are required in order to use a given package => ''depends'' +      * the packages that are required in order to use a given package => ''mamba repoquery **depends** package'' 
-      * the packages that need a given package => ''whoneeds''+        * Without ''mamba repoquery depends'', you would have to follow the steps in [[https://docs.conda.io/projects/conda/en/stable/user-guide/tasks/manage-pkgs.html#listing-package-dependencies|Listing package dependencies]] :-( 
 +      * the packages that need a given package => ''mamba repoquery **whoneeds** package''
     * Example: the ''[[https://github.com/tqdm/tqdm|tqdm]]'' package     * Example: the ''[[https://github.com/tqdm/tqdm|tqdm]]'' package
       * ''conda'' needs ''tqdm'' to display package download and installation progress, and the base dependencies of ''tqdm'' are ''[[https://github.com/tartley/colorama|colorama]]'', and of course ''python''       * ''conda'' needs ''tqdm'' to display package download and installation progress, and the base dependencies of ''tqdm'' are ''[[https://github.com/tartley/colorama|colorama]]'', and of course ''python''
Line 700: Line 734:
 </code> </code>
  
-  * Checking the health of an environment+  * **Checking the //health// of an environment** with ''[[https://docs.conda.io/projects/conda/en/stable/commands/doctor.html|conda doctor]]''
     * Some details in [[https://conda.org/blog/2023-06-01-conda-doctor/|Detecting conda environment inconsistencies easily]]     * Some details in [[https://conda.org/blog/2023-06-01-conda-doctor/|Detecting conda environment inconsistencies easily]]
 +      * ''conda doctor'' does not do much yet, and not necessarily in a useful way, but this will hopefully improve over time!
 +        * [[https://github.com/conda/conda/issues/14017|'conda doctor' output should be improved]]
 +        * [[https://github.com/conda/conda/issues/13574#issuecomment-2214291304|What exactly are altered files?]]
     * ''conda doctor -n base''     * ''conda doctor -n base''
     * Example:<code> >conda doctor -n base     * Example:<code> >conda doctor -n base
Line 717: Line 754:
 </code> </code>
  
-  * **Cleaning... <wrap em>Dangerous</wrap>**! +  * **Cleaning...** 
-    * ''conda'' does not automatically clean the content of the ''pkgs'' directory +    * ''conda'' does not automatically clean the content of the ''/path_to_miniconda/pkgs'' directory and the size of ''/path_to_miniconda/'' will keep on growingas you add new environments, or update existing ones 
-    * If you have several environments, ''conda clean'' may remove packages that are not needed in an environmentbut are still used in other environments, and **you may end up with a broken installation...** +    * All the details are in the [[#cleaning_up_miniconda3|Cleaning up Miniconda3...]] section
-    * More details in [[#cleaning_up_miniconda3|Cleaning up Miniconda3...]]+
  
  
Line 727: Line 763:
   * 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/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]]+  * Read the [[https://docs.conda.io/projects/conda/en/stable/user-guide/tasks/manage-environments.html#using-pip-in-an-environment|Using pip in a conda environment]] 
 +    * //Issues may arise when using pip and conda together//...
 ==== Installation history ==== ==== Installation history ====
  
Line 801: Line 838:
 FIXME FIXME
  
 +
 +===== Improving conda and related tools =====
 +
 +There is always room for improvement, and this is is some kind of //TODO// section
 +
 +==== conda and mamba ideas ====
 +
 +  * [[https://github.com/conda/conda/issues/14026|Add a conda command to find the package owning a file]]
 +    * The link also shows how to do it with standard Linux tools (find, grep), based on the [[https://docs.conda.io/projects/conda-build/en/stable/resources/package-spec.html#conda-package-specification|Conda package specification]] page
 +    * [[https://github.com/kelvinou01/conda-which|conda-which]] seems to work (see [[https://github.com/conda/conda/issues/14026#issuecomment-2268821608|test / example]]) !
  
 /* standard page footer */ /* standard page footer */
other/uvcdat/cdat_conda/miniconda3_install.1720103328.txt.gz · Last modified: 2024/07/04 16:28 by jypeter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki