Table of Contents

JYP steps for installing Miniconda3

Before installing Python on a shared computer

Desperately seeking a specific package

Check if the Python package you are desperately seeking is not already installed, before installing your own Python on shared interactive Linux servers, or on batch computing clusters !!

Using an unlisted Python distribution on a jupyter server

If there is a jupyter notebook server connected to your system, and a Python environment providing all the packages you need, but that is not directly available on the notebook server, follow the using a non-standard kernel instructions, rather than starting your own local server

Why should you use Miniconda3 ?

Downloading Miniconda3, and BASIC installation

Miniconda3 on a Windows computer

Some of the steps below are adapted from the Windows section of "Quick command line install" to install a pure Windows version of Miniconda3

Downloading the Miniconda3 installer on Windows

BASIC Miniconda3 installation on Windows

Miniconda3 on a Linux-like computer

By Linux-like, we mean:

  • A Linux desktop/laptop
    • The installation will be used by one person
  • A Linux server
    • The installation will be used by one or more persons
  • A windows computer with WSL+Ubuntu installed
    • You should use the 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

Downloading the Miniconda3 installer on Linux

Using the Miniconda3 installer on Linux

We assume below that we are in the directory where we have downloaded the installer

Fine-tuning conda to use (only) conda-forge

Be sure to also follow these steps on a Windows installation !

Why is it vital to use only conda-forge ?

Changing the .condarc file

The following steps will make sure that we only get packages from conda-forge (same thing as using the -c conda-forge option) by default, unless the requested packages really do not exist on conda-forge. More details in Managing channels

$ cat ~/.condarc  # On Windows use: cat $HOME\.condarc
cat: /home/jypmce/.condarc: No such file or directory

$ conda config --get channels

$ conda config --prepend channels conda-forge

$ conda config --set channel_priority strict

$ conda config --get channels
--add channels 'defaults'   # lowest priority
--add channels 'conda-forge'   # highest priority

$ cat ~/.condarc  # On Windows use: cat $HOME\.condarc
channels:
  - conda-forge
  - defaults
channel_priority: strict

Updating Miniconda3 at least once!

Before you go further, do not forget to update conda at least once in order to take all the changes above into account!

Adding mamba (optional)

  • Most people can (and should!) probably skip the mamba installation
  • Only install mamba if you are sure that you will need some features that are not already provided by conda (e.g. mamba repoquery)

mamba is a fast, robust, and cross-platform package manager […] fully compatible with conda packages, and supports most of conda’s commands

Installing mamba

Using mamba

Keeping (Mini)conda up-to-date

The update command

The first time we update Miniconda3...

We have to completely update Miniconda3 at least once after installing Miniconda3 and making conda-forge the highest priority channel

Cleaning up Miniconda3...

It seems safe to reclaim some disk space by cleaning up the initial (base) installation.

Use cleaning with caution after installing other environments…

You can clean the initial Miniconda3 installation to free up some disk space.

The documentation specifies WARNING: This will break environments with packages installed using symlinks back to the package cache.
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…)

(base) $ conda clean --all
Will remove 154 (180.9 MB) tarball(s).
Proceed ([y]/n)? y

Will remove 1 index cache(s).
Proceed ([y]/n)? y

Will remove 74 (378.0 MB) package(s).
Proceed ([y]/n)? y

There are no tempfile(s) to remove.
There are no logfile(s) to remove.

(base) $ du -sh /homedata/jypmce/miniconda3_2024-03
457M    /homedata/jypmce/miniconda3_2024-03

Initializing conda in terminals

Initializing conda on a Windows computer

TODO FIXME

Initializing conda on a Linux-like computer

When you open a terminal, your shell needs to know where to find the conda command used to initialize an environment, or switch between existing environments. This can be configured in your shell configuration files (.bashrc, .cshrc, …)

conda in a single-user Linux-like installation

You were asked the following question when installing Miniconda3: Do you wish to update your shell profile to automatically initialize conda? [yes|no]

conda in a multi-user Linux installation

We need to be extra-careful in the case of python environments maintained by a single user, but used by several users, in order not to break anything

We could use the same configuration file as in the single-user case, but it is more efficient to have the users source an intermediate initialization file. This intermediate init file will:

Using (mini)conda to create a new environment

conda resources

Web sites

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 official conda website

conda, pip and virtualenv

Installation history

You can get the current list of installed packages with conda list -n existing_environment, but it may also be useful to know in which order the packages were installed:

The conda MatchSpec format

Uninstalling Miniconda3

Windows computer

Miniconda3 can be removed like a regular Windows application

Linux-like computer

FIXME





[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]