Installing conda command line in various systems with miniconda and create a simple python environment

Conda is yet another package, dependency and environment management for multiple languages like Python, C/C++, JavaScript, Java, Scala and many more
For example, with Conda the user could create python environment with the exact versions he needs! And it could be used under any Linux distribution or even Windows.

This article is to show how to install the command-line version of the Conda, which is part of the bigger platform Anaconda. The command-line version is distributed with the name Miniconda. In fact, Miniconda is a free installer for Conda, which includes only the basic set to run conda and conda install to install more than 8000 packages from the Anaconda repositories.

The Anaconda repositories could be found here:

Advantages of Miniconda:

  1. Minimal installation. 400 Mbytes, not 3G for the Anaconda platform.
  2. simple command-line interface. Couple of simple commands and their instructions are enough to bring up a complex environment for scientific or development purposes.
  3. The creating of a specific environment could be automated.
  4. No strange or not friendly GUI.
  5. Easy installation under most of the Linux distribution and Windows.
  6. The whole installation could occur only under a user’s home directory. No files require to be installed by the administrator or under global administrative path.

STEP 1) Download miniconda3 from the official site

The official site offers multiple versions Python 3.7, 3.8 and 3.9 for Linux, MacOS and Windows.
The 64bit python 3.9 is chosen It does not matter what is the installed version under the system, on which is going to be installed the miniconda. The base conda environment will have Python 3.9, but environments with older or newer version could be created with no differ.
Download the file and make it executable.

myuser@srv ~ $
--2022-01-28 14:39:31--
Resolving,, 2606:4700::6810:8203, ...
Connecting to||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 66709754 (64M) [application/x-sh]
Saving to: ‘’

Miniconda3-py39_4.10.3-Linu 100%[=========================================>]  63.62M  1.82MB/s    in 29s     

2022-01-28 14:40:00 (2.20 MB/s) - ‘’ saved [66709754/66709754]
myuser@srv ~ $ chmod 755

STEP 2) Install miniconda.

After the file has been made executable it could be executed to start the installation process.

myuser@srv ~ $ ./ 

Welcome to Miniconda3 py39_4.10.3

In order to continue the installation process, please review the license
Please, press ENTER to continue
End User License Agreement - Miniconda

Copyright 2015-2021, Anaconda, Inc.

All rights reserved under the 3-clause BSD License:

This End User License Agreement (the "Agreement") is a legal agreement between you and Anaconda, Inc. ("Anaconda") and governs your use of Miniconda.

Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusive, non-transferable license to:

  * Install and use the Miniconda.
  * Modify and create derivative works of sample source code delivered in Miniconda subject to the Terms of Service for the Repository (as defined hereinafter) available at https://www.anac, and

  * Redistribute code files in source (if provided to you by Anaconda as source) and binary forms, with or without modification subject to the requirements set forth below.


Do you accept the license terms? [yes|no]
[no] >>> yes

Miniconda3 will now be installed into this location:

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify a different location below

[/home/myuser/miniconda3] >>> 
Unpacking payload ...
Collecting package metadata (current_repodata.json): done                                                                                                                                    
Solving environment: done

## Package Plan ##

  environment location: /home/myuser/miniconda3

  added / updated specs:
    - _libgcc_mutex==0.1=main
    - _openmp_mutex==4.5=1_gnu
    - brotlipy==0.7.0=py39h27cfd23_1003
    - ca-certificates==2021.7.5=h06a4308_1
    - certifi==2021.5.30=py39h06a4308_0
    - cffi==1.14.6=py39h400218f_0
    - chardet==4.0.0=py39h06a4308_1003
    - conda-package-handling==1.7.3=py39h27cfd23_1
    - conda==4.10.3=py39h06a4308_0
    - cryptography==3.4.7=py39hd23ed53_0
    - idna==2.10=pyhd3eb1b0_0
    - ld_impl_linux-64==2.35.1=h7274673_9
    - libffi==3.3=he6710b0_2
    - libgcc-ng==9.3.0=h5101ec6_17
    - libgomp==9.3.0=h5101ec6_17
    - libstdcxx-ng==9.3.0=hd4cf53a_17
    - ncurses==6.2=he6710b0_1
    - openssl==1.1.1k=h27cfd23_0
    - pip==21.1.3=py39h06a4308_0
    - pycosat==0.6.3=py39h27cfd23_0
    - pycparser==2.20=py_2
    - pyopenssl==20.0.1=pyhd3eb1b0_1
    - pysocks==1.7.1=py39h06a4308_0
    - python==3.9.5=h12debd9_4
    - readline==8.1=h27cfd23_0
    - requests==2.25.1=pyhd3eb1b0_0
    - ruamel_yaml==0.15.100=py39h27cfd23_0
    - setuptools==52.0.0=py39h06a4308_0
    - six==1.16.0=pyhd3eb1b0_0
    - sqlite==3.36.0=hc218d9a_0
    - tk==8.6.10=hbc83047_0
    - tqdm==4.61.2=pyhd3eb1b0_1
    - tzdata==2021a=h52ac0ba_0
    - urllib3==1.26.6=pyhd3eb1b0_1
    - wheel==0.36.2=pyhd3eb1b0_0
    - xz==5.2.5=h7b6447c_0
    - yaml==0.2.5=h7b6447c_0
    - zlib==1.2.11=h7b6447c_3

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-4.5-1_gnu
  brotlipy           pkgs/main/linux-64::brotlipy-0.7.0-py39h27cfd23_1003
  ca-certificates    pkgs/main/linux-64::ca-certificates-2021.7.5-h06a4308_1
  certifi            pkgs/main/linux-64::certifi-2021.5.30-py39h06a4308_0
  cffi               pkgs/main/linux-64::cffi-1.14.6-py39h400218f_0
  chardet            pkgs/main/linux-64::chardet-4.0.0-py39h06a4308_1003
  conda              pkgs/main/linux-64::conda-4.10.3-py39h06a4308_0
  conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.7.3-py39h27cfd23_1
  cryptography       pkgs/main/linux-64::cryptography-3.4.7-py39hd23ed53_0
  idna               pkgs/main/noarch::idna-2.10-pyhd3eb1b0_0
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.35.1-h7274673_9
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.3.0-h5101ec6_17
  libgomp            pkgs/main/linux-64::libgomp-9.3.0-h5101ec6_17
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.3.0-hd4cf53a_17
  ncurses            pkgs/main/linux-64::ncurses-6.2-he6710b0_1
  openssl            pkgs/main/linux-64::openssl-1.1.1k-h27cfd23_0
  pip                pkgs/main/linux-64::pip-21.1.3-py39h06a4308_0
  pycosat            pkgs/main/linux-64::pycosat-0.6.3-py39h27cfd23_0
  pycparser          pkgs/main/noarch::pycparser-2.20-py_2
  pyopenssl          pkgs/main/noarch::pyopenssl-20.0.1-pyhd3eb1b0_1
  pysocks            pkgs/main/linux-64::pysocks-1.7.1-py39h06a4308_0
  python             pkgs/main/linux-64::python-3.9.5-h12debd9_4
  readline           pkgs/main/linux-64::readline-8.1-h27cfd23_0
  requests           pkgs/main/noarch::requests-2.25.1-pyhd3eb1b0_0
  ruamel_yaml        pkgs/main/linux-64::ruamel_yaml-0.15.100-py39h27cfd23_0
  setuptools         pkgs/main/linux-64::setuptools-52.0.0-py39h06a4308_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
  sqlite             pkgs/main/linux-64::sqlite-3.36.0-hc218d9a_0
  tk                 pkgs/main/linux-64::tk-8.6.10-hbc83047_0
  tqdm               pkgs/main/noarch::tqdm-4.61.2-pyhd3eb1b0_1
  tzdata             pkgs/main/noarch::tzdata-2021a-h52ac0ba_0
  urllib3            pkgs/main/noarch::urllib3-1.26.6-pyhd3eb1b0_1
  wheel              pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  yaml               pkgs/main/linux-64::yaml-0.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3

Preparing transaction: done
Executing transaction: done
installation finished.
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>> yes
no change     /home/myuser/miniconda3/condabin/conda
no change     /home/myuser/miniconda3/bin/conda
no change     /home/myuser/miniconda3/bin/conda-env
no change     /home/myuser/miniconda3/bin/activate
no change     /home/myuser/miniconda3/bin/deactivate
no change     /home/myuser/miniconda3/etc/profile.d/
no change     /home/myuser/miniconda3/etc/fish/conf.d/
no change     /home/myuser/miniconda3/shell/condabin/Conda.psm1
no change     /home/myuser/miniconda3/shell/condabin/conda-hook.ps1
no change     /home/myuser/miniconda3/lib/python3.9/site-packages/xontrib/conda.xsh
no change     /home/myuser/miniconda3/etc/profile.d/conda.csh
modified      /home/myuser/.bashrc

==> For changes to take effect, close and re-open your current shell. <==

If you'd prefer that conda's base environment not be activated on startup, 
   set the auto_activate_base parameter to false: 

conda config --set auto_activate_base false

Thank you for installing Miniconda3!
myuser@srv ~ $

The End User License Agreement – Miniconda should be accepted and then the installation scripts asks for the installation path. The default installation path is “USER_HOME_DIR/miniconda3/“, i.e. /home/myuser/miniconda3.
Now, Miniconda3 is installed, but the user must log out and log in to take effect of the bash environments installed by the Miniconda3 installation process.
The last couple of lines are important because they state the user will activate the base conda environment on every login by default! If the user does not want any conda environment to be activated by default, just execute (after the first log out/in):

conda config --set auto_activate_base false

The python commands output version 3.9, which is the default base conda python environment, but not the one installed by the Linux distribution 3.8.

myuser@local ~ $ ssh myuser@srv
(myuser@srv) Password: 
(base) myuser@recommendation ~ $ python -V
Python 3.9.5

The conda commands available in this installation.

(base) myuser@srv ~ $ conda
usage: conda [-h] [-V] command ...

conda is a tool for managing and deploying applications, environments and packages.


positional arguments:
    clean        Remove unused packages and caches.
    compare      Compare packages between conda environments.
    config       Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (/home/myuser/.condarc) by default.
    create       Create a new conda environment from a list of specified packages.
    help         Displays a list of available conda commands and their help strings.
    info         Display information about current conda install.
    init         Initialize conda for shell interaction. [Experimental]
    install      Installs a list of packages into a specified conda environment.
    list         List linked packages in a conda environment.
    package      Low-level conda package utility. (EXPERIMENTAL)
    remove       Remove a list of packages from a specified conda environment.
    uninstall    Alias for conda remove.
    run          Run an executable in a conda environment. [Experimental]
    search       Search for packages and display associated information. The input is a MatchSpec, a query language for conda packages. See examples below.
    update       Updates conda packages to the latest compatible version.
    upgrade      Alias for conda update.

optional arguments:
  -h, --help     Show this help message and exit.
  -V, --version  Show the conda version number and exit.

conda commands available from other packages:
(base) myuser@srv ~ $

STEP 3) Create and activate conda environment.

After the conda successful installation first, create the environment and then activate it. The older python 3.7 is selected to show how to use two different python environment in the same machine and user:

(base) myuser@recommendation ~ $ conda create --name mypython37 python=3.7
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/myuser/miniconda3/envs/mypython37

  added / updated specs:
    - python=3.7

The following packages will be downloaded:

    package                    |            build
    pip-21.2.2                 |   py37h06a4308_0         1.8 MB
                                           Total:         1.8 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      pkgs/main/linux-64::_libgcc_mutex-0.1-main
  _openmp_mutex      pkgs/main/linux-64::_openmp_mutex-4.5-1_gnu
  ca-certificates    pkgs/main/linux-64::ca-certificates-2021.10.26-h06a4308_2
  certifi            pkgs/main/linux-64::certifi-2021.10.8-py37h06a4308_2
  ld_impl_linux-64   pkgs/main/linux-64::ld_impl_linux-64-2.35.1-h7274673_9
  libffi             pkgs/main/linux-64::libffi-3.3-he6710b0_2
  libgcc-ng          pkgs/main/linux-64::libgcc-ng-9.3.0-h5101ec6_17
  libgomp            pkgs/main/linux-64::libgomp-9.3.0-h5101ec6_17
  libstdcxx-ng       pkgs/main/linux-64::libstdcxx-ng-9.3.0-hd4cf53a_17
  ncurses            pkgs/main/linux-64::ncurses-6.3-h7f8727e_2
  openssl            pkgs/main/linux-64::openssl-1.1.1m-h7f8727e_0
  pip                pkgs/main/linux-64::pip-21.2.2-py37h06a4308_0
  python             pkgs/main/linux-64::python-3.7.11-h12debd9_0
  readline           pkgs/main/linux-64::readline-8.1.2-h7f8727e_1
  setuptools         pkgs/main/linux-64::setuptools-58.0.4-py37h06a4308_0
  sqlite             pkgs/main/linux-64::sqlite-3.37.0-hc218d9a_0
  tk                 pkgs/main/linux-64::tk-8.6.11-h1ccaba5_0
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  xz                 pkgs/main/linux-64::xz-5.2.5-h7b6447c_0
  zlib               pkgs/main/linux-64::zlib-1.2.11-h7f8727e_4

Proceed ([y]/n)? y

Downloading and Extracting Packages
pip-21.2.2           | 1.8 MB    | ################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
# To activate this environment, use
#     $ conda activate mypython37
# To deactivate an active environment, use
#     $ conda deactivate

(base) myuser@recommendation ~ $ python -V
Python 3.9.5
(base) myuser@recommendation ~ $ conda activate mypython37
(mypython37) myuser@recommendation ~ $ python -V
Python 3.7.11
(mypython37) myuser@recommendation ~ $

The user must confirm the packages installed with the new environment. Activating the new environment is straightforward and after that, all paths and environment variables are tuned to use the new Python version (3.7) in this case.

Leave a Reply

Your email address will not be published.