| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| other:uvcdat:cdat_conda:miniforge_install [2025/09/18 17:20] – [Miniforge3 on a Windows computer] Improved jypeter | other:uvcdat:cdat_conda:miniforge_install [2025/10/06 16:54] (current) – [Why should you use Miniconda3 ?] Updated version, now that we use miniforge instead of miniconda jypeter |
|---|
| |
| <note warning> | <note warning> |
| Starting the Miniforge3 page, based on Miniconda3 page | Starting the ''Miniforge3'' page, based on the ''[[other:uvcdat:cdat_conda:miniconda3_install|Miniconda3]]'' page |
| |
| LOTS of testing 'n editing to do!</note> | LOTS of testing 'n editing to do!</note> |
| ==== Desperately seeking a specific package ==== | ==== Desperately seeking a specific package ==== |
| |
| Check if the Python package you are [[https://www.imdb.com/title/tt0089017/|desperately seeking]] is not already installed, before installing your own Python environment **on shared interactive Linux servers, or on batch computing clusters** !! | **Before** installing your own Python environment, check if the Python package you are [[https://www.imdb.com/title/tt0089017/|desperately seeking]] is not already available in an existing Python distribution on the **shared interactive Linux servers**, or the **batch computing clusters** you have access to !! |
| |
| * Ask other users who know the local environment | <wrap hi>Do not reinvent the wheel and waste shared disk space</wrap> |
| | |
| | * Ask other users who know the local environments |
| |
| * Read the servers/clusters Python-related documentation: [[https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting|Python at LSCE by JYP]], [[https://intranet.lsce.ipsl.fr/informatique/index.php|LSCE]], [[https://documentations.ipsl.fr/spirit/spirit_clusters/python_modules.html|IPSL Mesocenter]], ... | * Read the servers/clusters Python-related documentation: [[https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting|Python at LSCE by JYP]], [[https://intranet.lsce.ipsl.fr/informatique/index.php|LSCE]], [[https://documentations.ipsl.fr/spirit/spirit_clusters/python_modules.html|IPSL Mesocenter]], ... |
| * there is a //jupyter notebook server// connected to your Linux cluster (e.g. https://jupyter.lsce.ipsl.fr/) | * there is a //jupyter notebook server// connected to your Linux cluster (e.g. https://jupyter.lsce.ipsl.fr/) |
| * and an existing Python environment on this cluster providing all the packages you need | * and an existing Python environment on this cluster providing all the packages you need |
| but this Python environment is not directly available on the notebook server (in the listed //kernels//), you should follow the [[other:python:starting#using_a_non-standard_kernel|using a non-standard kernel]] instructions, rather than starting your own local notebook server (on this multi-user computer) | **but** this Python environment is not directly available on the notebook server (i.e. not listed in the //kernels// pull-down menu), you should follow the [[other:python:starting#using_a_non-standard_kernel|using a non-standard kernel]] instructions, rather than starting your own local notebook server (on this multi-user computer) |
| ===== Why should you use Miniconda3 ? ===== | ===== Why should you use Miniforge3 ? ===== |
| |
| FIXME: try using [[https://conda-forge.org/download/|Miniforge3]] instead of Miniconda3 ? | <note tip> |
| | * **You should use [[https://conda-forge.org/download/|Miniforge3]]** instead of ''Miniconda3'' or ''Anaconda3'' because it is not provided by the Anaconda company and is **completely free** |
| | * Check the [[https://www.anaconda.com/legal|Anaconda Legal]] page for more details |
| | * People with an existing ''Miconconda3'' based installation can have a look at the old [[other:uvcdat:cdat_conda:miniconda3_install|JYP steps for installing Miniconda3]] page |
| | </note> |
| |
| * **//Miniconda3// is a minimal/bootstrap Python distribution** that can be used for creating more complex Python distributions.\\ It will basically make a recent ''conda'' command/executable available on your computer, and you can then use this ''conda'' executable to select an existing distribution, or create new and independent Python distributions. | * **//Miniforge3// provides a free minimal/bootstrap Python distribution** that can be used for creating more complex Python distributions.\\ It will basically make a recent ''conda'' command/executable available on your computer, and you can then use this ''conda'' executable to create new and independent Python distributions, or select an existing distribution. |
| |
| * A **conda //environment//** is basically (the short name of the directory) where you install the Python that you will use (independently of //Miniconda3// itself). You have to ''activate'' this environment in order to use it\\ \\ A **Python //distribution//** is the collection of packages (and their dependencies) you have chosen to install together in a given environment. | * A **conda //environment//** is basically (the short name of the directory) where you install the Python that you will use (independently of //Miniforge3// itself). You have to ''activate'' this environment in order to use it\\ \\ A **Python //distribution//** is the collection of packages (and their dependencies) you have chosen to install together in a given environment. |
| * Example: initializing an environment named ''cdatm_py3'' (assuming it exists) in a //bash// shell <code>$ source /path_to_miniconda/etc/profile.d/conda.sh | * Example: initializing an environment named ''cdatm_py3'' (assuming it exists) in a //bash// shell <code>$ source /path_to_miniforge/etc/profile.d/conda.sh |
| |
| $ which conda | $ which conda |
| /path_to_miniconda/condabin/conda | /path_to_miniforge/condabin/conda |
| |
| $ conda env list | $ conda env list |
| [...] | [...] |
| cdatm_py3 /path_to_miniconda/envs/cdatm_py3 | cdatm_py3 /path_to_miniforge/envs/cdatm_py3 |
| some_other_env /path_to_miniconda/envs/some_other_env | some_other_env /path_to_miniforge/envs/some_other_env |
| |
| $ conda activate cdatm_py3 | $ conda activate cdatm_py3 |
| |
| (cdatm_py3) $ which python | (cdatm_py3) $ which python |
| /path_to_miniconda/envs/cdatm_py3/bin/python | /path_to_miniforge/envs/cdatm_py3/bin/python |
| </code> | </code> |
| * 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 | * The //special// environment where //Miniforge3// 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 |
| /path_to_miniconda/bin/python | /path_to_miniforge/bin/python |
| </code> | </code> |
| |
| * You **don't need to be (and you should not be !!) //root//** when you install //Miniconda3//. You just **need //enough// disk space** on a disk where you have write access | * You **don't need to be (and you should not be !!) //root//** when you install //Miniforge3//. You just **need //enough// disk space** on a disk where you have write access |
| * **WARNING**: by default, //Miniconda3// will install itself and subsequent Python environments in a sub-directory of your home directory (''~/miniconda3'' on Linux). **Do not use the default installation location**, if you want to avoid disk space related problems (//disk full//, //quota exceeded//, ...) during the inittial installation or later | * **WARNING**: by default, //Miniforge3// will install itself and subsequent Python environments in a sub-directory of your home directory (''~/miniforge3'' on Linux). **Do not use the default installation location**, if you want to avoid disk space related problems (//disk full//, //quota exceeded//, ...) during the initial installation or later |
| * **WARNING**: older versions of //Miniconda3// used a **hidden sub-directory** of the home directory of the person installing //Miniconda3// (''~/.conda'' on Linux) | * **WARNING**: older versions of //Miniforge3// used a **hidden sub-directory** of the home directory of the person installing //Miniforge3// (''~/.conda'' on Linux) |
| * Choose carefully where you will install //Miniconda3//, because the size of the installation directory will start at a few Gb and will keep on growing | * Choose carefully where you will install //Miniforge3//, because the size of the installation directory will start at a few Gb and will keep on growing |
| | |
| * You //could// also start with the full //Anaconda// (instead of //Miniconda//) installer, that will install a much more complete python environment, ready for use.\\ **We choose not to use the full //Anaconda// installer** because: | |
| * It requires more disk space than //Miniconda3// during the initial installation, | |
| * 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** | |
| |
| |
| === Downloading the Miniforge3 installer on Windows === | === Downloading the Miniforge3 installer on Windows === |
| |
| * The download link we use later always points to the latest version of the Windows installer | * The generic download link we use always points to the latest available version of the Windows installer |
| * https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe | * ''https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe'' |
| * September 2025: The ''Miniforge3 25.3.1-0'' installer is based on ''Python 3.12.11'' and ''Conda 25.3.1'' as of April 2024 | * Visit the [[https://github.com/conda-forge/miniforge/releases/latest|latest release page]] if you want to know the actual version number |
| | * October 2025: The ''Miniforge3 25.3.1-0'' installer is based on ''Python 3.12.11'' and ''Conda 25.3.1'' |
| |
| * Find some temporary disk space on Windows | * Find some temporary disk space on Windows to download the installer (71 Mb as of October 2025) |
| * e.g. ''C:\Scratch\your_login'' or whatever you use as a [[other:win10config#local_scratch_folder|local Scratch folder]] | * e.g. ''C:\Scratch\your_login'' or whatever you use as a [[other:win10config#local_scratch_folder|local Scratch folder]] |
| |
| * We recommend installing [[other:win10apps#windows_terminal|Windows Terminal]] and making it the default terminal for using Powershell | * We recommend installing [[other:win10apps#windows_terminal|Windows Terminal]] and making it the default terminal for using Powershell |
| |
| * Use ''curl'' to download the latest installer (71 Mb as of September 2025): <code>PS C:\> cd C:\Scratch\your_login | * Use ''curl'' to download the latest installer (71 Mb as of October 2025): <code>PS C:\> cd C:\Scratch\your_login |
| |
| PS C:\Scratch\your_login> curl https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe -o miniforge3.exe | PS C:\Scratch\your_login> curl https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe -o miniforge3.exe |
| |
| * **Determine the folder where you will install Miniforge3 and ALL your future Python environments** based on this version of Miniforge3\\ **We will later refer to this installation location as ''/path_to_miniforge3/''** in the [[#miniforge3_on_a_linux-like_computer|Linux sections]] below | * **Determine the folder where you will install Miniforge3 and ALL your future Python environments** based on this version of Miniforge3\\ **We will later refer to this installation location as ''/path_to_miniforge3/''** in the [[#miniforge3_on_a_linux-like_computer|Linux sections]] below |
| * Remember that **you will need a few Gb of available space** | * Remember that **you will need a few Gb of available disk space** |
| * You should **avoid installing Miniforge3 in your Windows //home// folder** (''C:\Users\your_login'' or [[other:win10config#local_home_folder|<some_disk_different_from_c>:\Users\<your_login>]]), if you want to be able to easily make backups or your //home// folder, without backing up thousands of files related to your Python environments... | * You should **avoid installing Miniforge3 in your Windows //home// folder** (''C:\Users\your_login'' or [[other:win10config#local_home_folder|<some_disk_different_from_c>:\Users\<your_login>]]), if you want to be able to easily create backups or your //home// folder, without backing up thousands of files related to your Python environments... |
| * We add some date or version information at the end of the folder name, in order to differentiate it from other (older of future) installations | * We add some date or version information at the end of the folder name, in order to differentiate it from other (older of future) installations |
| * Example installation folder: ''C:\Utils\miniforge3_2025-09'' (if we start installing in September 2025) | * Example installation folder: ''C:\Utils\miniforge3_2025-10'' (if we start installing in October 2025) |
| |
| * Launch the Miniforge3 installer with<code>PS C:\Scratch\your_login> .\miniforge3.exe</code> | * Launch the Miniforge3 installer with<code>PS C:\Scratch\your_login> .\miniforge3.exe</code> |
| |
| * In the installer window: | * In the installer window: |
| * (Review and) accept the License Agreement | * (Review and) accept the //License Agreement// |
| * Choose to install for //Just Me// (the recommended default choice) | * Choose to install for //Just Me// (the recommended default choice) |
| * Specify the //Destination Folder// selected above, e.g. ''C:\Utils\miniforge3_2025-09'' | * Specify the //Destination Folder// selected above,\\ e.g. ''C:\Utils\miniforge3_2025-10'' |
| * Use the following //Advanced Installation Options// (probably pre-selected).\\ These options should have no side-effects on your system, or other Python installations already available on your system | * Use (only) the following //Advanced Installation Options// (probably pre-selected).\\ These options should have no side-effects on your system, or other existing Python installations on your system |
| * //Create start menu shortcuts// | * //Create shortcuts// |
| | * This will add shortcuts to the Windows ''Start'' menu |
| * //Clear the package cache upon completion// | * //Clear the package cache upon completion// |
| |
| * When the installer has finished running, you should have: | * When the installer has finished running, you should have: |
| * A new ''C:\Utils\miniforge3_2025-09'' folder | * A new ''C:\Utils\miniforge3_2025-10'' folder |
| * This folder size will be ~300 Mb (as of September 2025) and will keep on growing (up to several Gb) as you add more Python environments and packages | * This folder size will be ~300 Mb (as of October 2025) and will keep on growing (up to several Gb) as you add more Python environments and packages |
| * => **Be sure to have enough space on the installation disk!** | * => **Be sure to always have enough space on the installation disk!** |
| * A new shortcut in the Windows ''Start''=>''M''=>''Miniforge3'' menu: | * A new shortcut in the Windows ''Start'' menu: |
| * ''Miniforge Prompt'' | * ''Start''=>''M''=>''Miniforge3'' menu: |
| * We will now use this ''Miniforge Prompt'' shortcut each time we need to use a ''conda'' or ''python'' related to this installation of miniforge3 | * ''Miniforge Prompt'' shortcut |
| * We recommended to [[other:win10apps#windows_terminal|installing Windows Terminal and making it the default terminal application]], so that the ''conda'' prompts will open in a modern (and highly configurable) terminal | * We will now use this ''Miniforge Prompt'' shortcut each time we need to use a ''conda'' or ''python'' executable related to this installation of miniforge3 |
| | * We recommend to [[other:win10apps#windows_terminal|install Windows Terminal and make it the default terminal application]], so that the ''Miniforge'' prompts will open in a modern (and highly configurable) Windows terminal |
| |
| * Remove the installer<code>PS C:\Scratch\your_login> del miniforge3.exe</code> | * Remove the installer<code>PS C:\Scratch\your_login> del miniforge3.exe</code> |
| |
| * Open a //Miniforge Prompt//, and type a few commands to make sure that the newly installed ''conda'' and python are working\\ Opening a Miniforge prompt will automatically initialize the Python ''(base)'' environment installed with the Miniforge3 installer. | * Open a //Miniforge Prompt//, and type a few commands to make sure that the newly installed ''conda'' and ''python'' run correctly\\ Opening a ''Miniforge prompt'' will automatically initialize the Python ''(base)'' environment installed with the Miniforge3 installer. |
| * ''Start''=>''M''=>''Miniforge3'' => ''Miniforge Prompt'' | * ''Start''=>''M''=>''Miniforge3'' => ''Miniforge Prompt'' |
| * <code>(base) C:\Users\your_login>where.exe conda | * <code>(base) C:\Users\your_login>where.exe conda |
| C:\Utils\miniforge3_2025-09\Library\bin\conda.bat | C:\Utils\miniforge3_2025-10\Library\bin\conda.bat |
| C:\Utils\miniforge3_2025-09\Scripts\conda.exe | C:\Utils\miniforge3_2025-10\Scripts\conda.exe |
| C:\Utils\miniforge3_2025-09\condabin\conda.bat | C:\Utils\miniforge3_2025-10\condabin\conda.bat |
| |
| (base) C:\Users\your_login>conda --version | (base) C:\Users\your_login>conda --version |
| # conda environments: | # conda environments: |
| # | # |
| base * C:\Utils\miniforge3_2025-09 | base * C:\Utils\miniforge3_2025-10 |
| |
| (base) C:\Users\your_login>conda list | (base) C:\Users\your_login>conda list |
| # packages in environment at C:\Utils\miniforge3_2025-09: | # packages in environment at C:\Utils\miniforge3_2025-10: |
| # | # |
| # Name Version Build Channel | # Name Version Build Channel |
| >>> pprint.pprint(sys.path) | >>> pprint.pprint(sys.path) |
| ['', | ['', |
| 'C:\\Utils\\miniforge3_2025-09\\python312.zip', | 'C:\\Utils\\miniforge3_2025-10\\python312.zip', |
| 'C:\\Utils\\miniforge3_2025-09\\DLLs', | 'C:\\Utils\\miniforge3_2025-10\\DLLs', |
| 'C:\\Utils\\miniforge3_2025-09\\Lib', | 'C:\\Utils\\miniforge3_2025-10\\Lib', |
| 'C:\\Utils\\miniforge3_2025-09', | 'C:\\Utils\\miniforge3_2025-10', |
| 'C:\\Utils\\miniforge3_2025-09\\Lib\\site-packages'] | 'C:\\Utils\\miniforge3_2025-10\\Lib\\site-packages'] |
| >>> ^Z</code> | >>> ^Z</code> |
| | |
| | * Check if ''conda-forge'' is the default and only channel that ''conda'' will use to update the newly installed ''base'' environment, and future environments |
| | * The ''%%--%%get channels'' command should only mention ''%%'%%conda-forge%%'%%''<code>(base) C:\Users\jypeter>conda config --get channels |
| | --add channels 'conda-forge' # lowest priority</code> |
| | * **If you get something else**, you may have a ''.condarc'' configuration file left over from a previous ''conda'' installation. Depending on its content, you may have to remove or edit the ''.condarc'' file, or it may be OK to leave it unchanged |
| | * Example: you use a ''cmd'' terminal, and there is NO existing ''.condarc'' file<code>(base) C:\Users\your_login>more %HOMEPATH%\.condarc |
| | Impossible d’accéder au fichier C:\Users\your_login\.condarc</code> |
| | * Example: you use a Powershell terminal, and there is a configuration file. The configuration below is OK, because it only mentions the ''%%'%%conda-forge%%'%%'' channel we want<code>(base) PS C:\Users\your_login> more $HOME\.condarc |
| | channels: |
| | - conda-forge |
| | channel_priority: strict</code> |
| |
| * **Next**: follow **all** the other Miniforge3 related instructions for the other Operating Systems | * **Next**: follow **all** the other Miniforge3 related instructions for the other Operating Systems |
| * ''conda'' **commands will work the same way on all Operating Systems** (Windows and Linux-like) | * ''conda'' **commands will work the same way on all Operating Systems** (Windows and Linux-like) |
| * The ''.condarc'' is located in your Windows //home// folder\\ => ''C:\Users\your_login\.condarc'' | * If instructions mention the ''.condarc'' configuration file, it is located in your Windows //home// folder\\ => ''C:\Users\your_login\.condarc'' |
| * Easily displaying the configuration file | * Easily displaying the configuration file |
| * ''cmd'': ''more %HOMEPATH%\.condarc'' | * ''cmd'': ''more %HOMEPATH%\.condarc'' |