How to Install Miniconda on Ubuntu 18.04/16.04 Linux
This post will guide you how to install Miniconda on your Ubuntu 18.04 or 16.04 Linux server. How do I use Miniconda tool to install/update/uninstall packages on Ubuntu Linux server.
- What is Miniconda?
- Installing Miniconda
- List All installed Conda Packages
- Search for Packages from Conda Repository
- Installing Package Using Conda
- Update Package Using Conda
- Remove Package Using Conda
What is Miniconda?
Conda is an open source package management system and environment management system that runs on Windows, macOS and Linux. Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language.
Miniconda is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on and a small number of other useful packages, including pip, zlib and a few others. Use the conda install command to install 720+ additional conda packages from the Anaconda repository.
we have talked that how to install Anaconda on Ubuntu system in the previous post, and Anaconda is around 500MB size and needs 3GB of available disk space with collection of 720+ additional conda packages. And Miniconda is only need 43 MB disk space on your system. So Miniconda is a light version of Anaconda which makes it suitable to install on your Ubuntu Linux server.
Installing Miniconda
You need to visit the official website of Conda to download the latest version of Miniconda. and you need to select the correct version of Miniconda based on Python version installed on your system.
Type the following command to check the python version:
$ python --version
Outputs:
root@devops:~# python --version Python 2.7.15rc1
So you need to download the latest python27 version of Miniconda with the following wget command:
$ wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh
outputs:
root@devops:~# wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh --2019-03-12 21:57:31-- https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.131.3, 104.16.130.3, 2606:4700::6810:8303, ... Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.131.3|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 44861818 (43M) [application/x-sh] Saving to: ‘Miniconda2-latest-Linux-x86_64.sh’ Miniconda2-latest-Linux-x86_64.sh 100%[==========================================================================================================>] 42.78M 2.47MB/s in 17s 2019-03-12 21:57:49 (2.48 MB/s) - ‘Miniconda2-latest-Linux-x86_64.sh’ saved [44861818/44861818] root@devops:~#
Once Miniconda is download on your local disk, you can start to install it with the following command:
$ sh Miniconda2-latest-Linux-x86_64.sh
Note: you need to review the license terms, then press Enter key to continue the installation process, type yes to accept the license terms, specify your location where you want to install Miniconda or you just press Enter key to use the default installation location. Then type yes when prompted by “Do you wish the installer to initalize miniconda2 in your /roo/.bashrc?” .
Outputs:
root@devops:~# sh Miniconda2-latest-Linux-x86_64.sh Welcome to Miniconda2 4.5.12 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>> =================================== Miniconda End User License Agreement =================================== Copyright 2015, Anaconda, Inc. All rights reserved under the 3-clause BSD License: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ..... Do you accept the license terms? [yes|no] [no] >>> yes Miniconda2 will now be installed into this location: /root/miniconda2 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/root/miniconda2] >>> PREFIX=/root/miniconda2 installing: python-2.7.15-h9bab390_6 ... Python 2.7.15 :: Anaconda, Inc. installing: ca-certificates-2018.03.07-0 ... installing: pip-18.1-py27_0 ... installing: pyopenssl-18.0.0-py27_0 ... installing: urllib3-1.24.1-py27_0 ... installing: requests-2.21.0-py27_0 ... installing: conda-4.5.12-py27_0 ... installation finished. Do you wish the installer to initialize Miniconda2 in your /root/.bashrc ? [yes|no] [no] >>> yes Initializing Miniconda2 in /root/.bashrc A backup will be made to: /root/.bashrc-miniconda2.bak For this change to become active, you have to open a new terminal. Thank you for installing Miniconda2! root@devops:~#
If you want changes to take effect, you need to close and reopen your current SSH session or run the following command:
$ source .bashrc
Then you can verify that if Miniconda is installed successfully with the following command:
$ conda -h $ conda -V
Outputs:
root@devops:~# conda -h usage: conda [-h] [-V] command ... conda is a tool for managing and deploying applications, environments and packages. Options: positional arguments: command clean Remove unused packages and caches. config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file (/root/.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. 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. See conda remove --help. 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. This command accepts a list of package names and updates them to the latest versions that are compatible with all other packages in the environment. Conda attempts to install the newest versions of the requested packages. To accomplish this, it may update some packages that are already installed, or install additional packages. To prevent existing packages from updating, use the --no-update-deps option. This may force conda to install older versions of the requested packages, and it does not prevent additional dependency packages from being installed. If you wish to skip dependency checking altogether, use the '--force' option. This may result in an environment with incompatible packages, so this option must be used with great caution. upgrade Alias for conda update. See conda update --help. 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: env root@devops:~# root@devops:~# conda -V conda 4.5.12
From the above outputs, you can get the help information and version number of Miniconda.
List All installed Conda Packages
If you want to list all installed conda packages on your current Ubuntu system, you can use the following command to get it:
$ conda list
Outputs:
root@devops:~# conda list # packages in environment at /root/miniconda2: # # Name Version Build Channel asn1crypto 0.24.0 py27_0 ca-certificates 2018.03.07 0 certifi 2018.11.29 py27_0 cffi 1.11.5 py27he75722e_1 chardet 3.0.4 py27_1 conda 4.5.12 py27_0 conda-env 2.6.0 1 cryptography 2.4.2 py27h1ba5d50_0 enum34 1.1.6 py27_1 .......
Search for Packages from Conda Repository
Before installed a package, you can try to search for this package from default Conda repository to list all version of packages that you can use to install.
For example, you want to search for a package called scrapy, you can use conda search command to search it:
$ conda search scrapy
Outputs:
root@devops:~# conda search scrapy Loading channels: done # Name Version Build Channel scrapy 0.16.4 py26_0 pkgs/free scrapy 0.16.4 py27_0 pkgs/free scrapy 0.24.4 py27_0 pkgs/free scrapy 1.0.1 py27_0 pkgs/free scrapy 1.0.3 py27_0 pkgs/free scrapy 1.1.1 py27_0 pkgs/free scrapy 1.1.1 py34_0 pkgs/free scrapy 1.1.1 py35_0 pkgs/free scrapy 1.1.1 py36_0 pkgs/free scrapy 1.3.3 py27_0 pkgs/free scrapy 1.3.3 py35_0 pkgs/free scrapy 1.3.3 py36_0 pkgs/free scrapy 1.4.0 py27h060f748_1 pkgs/main scrapy 1.4.0 py35h03cf01c_1 pkgs/main scrapy 1.4.0 py36h5dd8a1d_1 pkgs/main scrapy 1.5.0 py27_0 pkgs/main scrapy 1.5.0 py35_0 pkgs/main scrapy 1.5.0 py36_0 pkgs/main scrapy 1.5.0 py37_0 pkgs/main scrapy 1.5.1 py27_0 pkgs/main scrapy 1.5.1 py35_0 pkgs/main scrapy 1.5.1 py36_0 pkgs/main scrapy 1.5.1 py37_0 pkgs/main root@devops:~#
From the above outputs, you should know that which version of scrapy that you can install it from Conda repository.
Installing Package Using Conda
If you want to install a pcakge using conda tool, you can use conda install command to install it. Using the following command to install scrapy package:
$ conda install scrapy
If you want to install a certain version of scrap package, For example, scrapy 1.5.1, you can use the following command:
$ conda install scrapy=1.5.1
Update Package Using Conda
If you want to update a package installed by conda, you can use the conda update or conda upgrade to update that package to the latest version, type:
$ conda update scrapy
or
$ conda upgrade scrapy
Remove Package Using Conda
if you want to remove or uninstall a package, you can use conda remove or conda uninstall to remove a given package. type:
$ conda remove scrapy
or
$ conda unintall scrapy
Colclusion
You should know that how to download and install the latest version of Miniconda on Ubuntu 16.04 or 18.04 from this guide. If you want to see more information about Conda or Miniconda, you can go the official web site of Conda directly.