To install Miniconda on Ubuntu 20.04 from command line, it only takes 3 steps excluding creating and activating a conda environment.
- Download the latest shell script
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
- Make the miniconda installation script executable
chmod +x Miniconda3-latest-Linux-x86_64.sh
- Run miniconda installation script
./Miniconda3-latest-Linux-x86_64.sh
- Create and activate an conda environment
To create a conda environment, run
conda create -n newenv
You can also create the environment from a file likeenvironment.yml, you can use use theconda env create -fcommand:conda env create -f environment.yml. The environment name will be the directory name.
Contents
What is Miniconda?
Miniconda is a minimal free Conda installer. It’s a thin, bootstrap version that contains just conda, Python, the packages they depend on, and a limited range of other helpful modules like pip, zlib, and a few others. To install additional conda packages from Anaconda registry, using the conda install command.
Installing Miniconda is the quickest way to get conda. Install Anaconda if you want to get conda plus over 7,500 open source packages.
As we’ve done above, you installed Anaconda as a non-root user, which does not need permissions from the administrator and is the most stable form of installation. You may also install Anaconda system-wide which needs permissions from the administrator.
A better understanding of miniconda installation
To gain a better understanding, visit miniconda documentation to take a look.
- The homepage is https://docs.conda.io/en/latest/miniconda.html.
- The installation instructions are https://conda.io/projects/conda/en/latest/user-guide/install/index.html.
- Verification of installation is https://conda.io/projects/conda/en/latest/user-guide/install/download.html#cryptographic-hash-verification.
How to avoid conda to activate base environment?
By default conda init will add to your .bashrc file for the base environment, which will slow down your terminal.
You can remove them in your .bashrc file or answer no to that question in the last step of your miniconda installation.
And then add the following to your .bashrc file. If you changed the default installation directory, change ~/miniconda3/ to that directory.
source ~/miniconda3/etc/profile.d/conda.sh
if [[ -z ${CONDA_PREFIX+x} ]]; then
export PATH="~/conda/bin:$PATH"
fi
To test it, open a new terminal tab or run source .bashrc. Run conda activate base, then you should see (base) in front of your Bash prompt.
Now you can create another environment and activate it using Miniconda. If you frequently use one environment, you can also add conda activate [env] to your .bashrc file.
The output of the miniconda installation shell script
For your reference, here is whole output of a successful miniconda installation on Ubuntu 20.04.
$ ./Miniconda3-latest-Linux-x86_64.sh
Welcome to Miniconda3 4.8.2
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
===================================
End User License Agreement - Anaconda Individual Edition
===================================
Copyright 2015-2020, 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 Anaconda Individual Edition (which was for
merly known as Anaconda Distribution).
Subject to the terms of this Agreement, Anaconda hereby grants you a non-exclusive, non-transferable license to:
* Install and use the Anaconda Individual Edition (which was formerly known as Anaconda Distribution),
* Modify and create derivative works of sample source code delivered in Anaconda Individual Edition; 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.
Anaconda may, at its option, make available patches, workarounds or other updates to Anaconda Individual Edition. Unless the updates are provided with their separate governing terms
, they are deemed part of Anaconda Individual Edition licensed to you as provided in this Agreement. This Agreement does not entitle you to any support for Anaconda Individual Edit
ion.
Anaconda reserves all rights not expressly granted to you in this Agreement.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provid
ed with the distribution.
* Neither the name of Anaconda nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
You acknowledge that, as between you and Anaconda, Anaconda owns all right, title, and interest, including all intellectual property rights, in and to Anaconda Individual Edition an
d, with respect to third-party products distributed with or in Anaconda Individual Edition, the applicable third-party licensors own all right, title and interest, including all int
ellectual property rights, in and to such products. If you send or transmit any communications or materials to Anaconda suggesting or recommending changes to the software or docume
ntation, including without limitation, new features or functionality relating thereto, or any comments, questions, suggestions or the like ("Feedback"), Anaconda is free to use such
Feedback. You hereby assign to Anaconda all right, title, and interest in, and Anaconda is free to use, without any attribution or compensation to any party, any ideas, know-how, c
oncepts, techniques or other intellectual property rights contained in the Feedback, for any purpose whatsoever, although Anaconda is not required to use any Feedback.
THIS SOFTWARE IS PROVIDED BY ANACONDA AND ITS CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AN
D FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANACONDA BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
TO THE MAXIMUM EXTENT PERMITTED BY LAW, ANACONDA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS OF
USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE OF ANACONDA INDIV
IDUAL EDITION, WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF A
CTION OR THEORY OF LIABILITY. IN NO EVENT WILL THE TOTAL CUMULATIVE LIABILITY OF ANACONDA AND ITS AFFILIATES UNDER OR ARISING OUT OF THIS AGREEMENT EXCEED US.00.
Do you accept the license terms? [yes|no]
[no] >>> yes
Miniconda3 will now be installed into this location:
/home/zhao/miniconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/zhao/miniconda3] >>>
PREFIX=/home/zhao/miniconda3
Unpacking payload ...
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: /home/zhao/miniconda3
added / updated specs:
- _libgcc_mutex==0.1=main
- asn1crypto==1.3.0=py37_0
- ca-certificates==2020.1.1=0
- certifi==2019.11.28=py37_0
- cffi==1.14.0=py37h2e261b9_0
- chardet==3.0.4=py37_1003
- conda-package-handling==1.6.0=py37h7b6447c_0
- conda==4.8.2=py37_0
- cryptography==2.8=py37h1ba5d50_0
- idna==2.8=py37_0
- ld_impl_linux-64==2.33.1=h53a641e_7
- libedit==3.1.20181209=hc058e9b_0
- libffi==3.2.1=hd88cf55_4
- libgcc-ng==9.1.0=hdf63c60_0
- libstdcxx-ng==9.1.0=hdf63c60_0
- ncurses==6.2=he6710b0_0
- openssl==1.1.1d=h7b6447c_4
- pip==20.0.2=py37_1
- pycosat==0.6.3=py37h7b6447c_0
- pycparser==2.19=py37_0
- pyopenssl==19.1.0=py37_0
- pysocks==1.7.1=py37_0
- python==3.7.6=h0371630_2
- readline==7.0=h7b6447c_5
- requests==2.22.0=py37_1
- ruamel_yaml==0.15.87=py37h7b6447c_0
- setuptools==45.2.0=py37_0
- six==1.14.0=py37_0
- sqlite==3.31.1=h7b6447c_0
- tk==8.6.8=hbc83047_0
- tqdm==4.42.1=py_0
- urllib3==1.25.8=py37_0
- wheel==0.34.2=py37_0
- xz==5.2.4=h14c3975_4
- yaml==0.1.7=had09818_2
- zlib==1.2.11=h7b6447c_3
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
asn1crypto pkgs/main/linux-64::asn1crypto-1.3.0-py37_0
ca-certificates pkgs/main/linux-64::ca-certificates-2020.1.1-0
certifi pkgs/main/linux-64::certifi-2019.11.28-py37_0
cffi pkgs/main/linux-64::cffi-1.14.0-py37h2e261b9_0
chardet pkgs/main/linux-64::chardet-3.0.4-py37_1003
conda pkgs/main/linux-64::conda-4.8.2-py37_0
conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.6.0-py37h7b6447c_0
cryptography pkgs/main/linux-64::cryptography-2.8-py37h1ba5d50_0
idna pkgs/main/linux-64::idna-2.8-py37_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
libedit pkgs/main/linux-64::libedit-3.1.20181209-hc058e9b_0
libffi pkgs/main/linux-64::libffi-3.2.1-hd88cf55_4
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
ncurses pkgs/main/linux-64::ncurses-6.2-he6710b0_0
openssl pkgs/main/linux-64::openssl-1.1.1d-h7b6447c_4
pip pkgs/main/linux-64::pip-20.0.2-py37_1
pycosat pkgs/main/linux-64::pycosat-0.6.3-py37h7b6447c_0
pycparser pkgs/main/linux-64::pycparser-2.19-py37_0
pyopenssl pkgs/main/linux-64::pyopenssl-19.1.0-py37_0
pysocks pkgs/main/linux-64::pysocks-1.7.1-py37_0
python pkgs/main/linux-64::python-3.7.6-h0371630_2
readline pkgs/main/linux-64::readline-7.0-h7b6447c_5
requests pkgs/main/linux-64::requests-2.22.0-py37_1
ruamel_yaml pkgs/main/linux-64::ruamel_yaml-0.15.87-py37h7b6447c_0
setuptools pkgs/main/linux-64::setuptools-45.2.0-py37_0
six pkgs/main/linux-64::six-1.14.0-py37_0
sqlite pkgs/main/linux-64::sqlite-3.31.1-h7b6447c_0
tk pkgs/main/linux-64::tk-8.6.8-hbc83047_0
tqdm pkgs/main/noarch::tqdm-4.42.1-py_0
urllib3 pkgs/main/linux-64::urllib3-1.25.8-py37_0
wheel pkgs/main/linux-64::wheel-0.34.2-py37_0
xz pkgs/main/linux-64::xz-5.2.4-h14c3975_4
yaml pkgs/main/linux-64::yaml-0.1.7-had09818_2
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3
Preparing transaction: done
Executing transaction: done
installation finished.
WARNING:
You currently have a PYTHONPATH environment variable set. This may cause
unexpected behavior when running the Python interpreter in Miniconda3.
For best results, please verify that your PYTHONPATH only points to
directories of packages that are compatible with the Python interpreter
in Miniconda3: /home/zhao/miniconda3
Do you wish the installer to initialize Miniconda3
by running conda init? [yes|no]
[no] >>>
You have chosen to not have conda modify your shell scripts at all.
To activate conda's base environment in your current shell session:
eval "$(/home/zhao/miniconda3/bin/conda shell.YOUR_SHELL_NAME hook)"
To install conda's shell functions for easier access, first activate, then:
conda init
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!
The output of conda environment creation
For your reference, here is the sample output of conda environment creation from this GitHub repo: https://github.com/chrischute/squad
$ conda env create -f environment.yml Collecting package metadata (repodata.json): done Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.8.2 latest version: 4.8.3 Please update conda by running $ conda update -n base -c defaults conda Downloading and Extracting Packages werkzeug-1.0.1 | 239 KB | ########################################################################################################################################## | 100% libcblas-3.8.0 | 10 KB | ########################################################################################################################################## | 100% ca-certificates-2020 | 146 KB | ########################################################################################################################################## | 100% plac-0.9.6 | 18 KB | ########################################################################################################################################## | 100% python-3.6.10 | 34.1 MB | ########################################################################################################################################## | 100% chardet-3.0.4 | 188 KB | ########################################################################################################################################## | 100% sqlite-3.30.1 | 2.0 MB | ########################################################################################################################################## | 100% xz-5.2.5 | 430 KB | ########################################################################################################################################## | 100% keras-preprocessing- | 33 KB | ########################################################################################################################################## | 100% libpng-1.6.37 | 308 KB | ########################################################################################################################################## | 100% wrapt-1.10.11 | 45 KB | ########################################################################################################################################## | 100% libedit-3.1.20170329 | 172 KB | ########################################################################################################################################## | 100% liblapack-3.8.0 | 10 KB | ########################################################################################################################################## | 100% mkl-2020.0 | 202.0 MB | ########################################################################################################################################## | 100% c-ares-1.15.0 | 100 KB | ########################################################################################################################################## | 100% libgfortran-ng-7.3.0 | 1.7 MB | ########################################################################################################################################## | 100% tensorflow-estimator | 181 KB | ########################################################################################################################################## | 100% setuptools-46.1.3 | 653 KB | ########################################################################################################################################## | 100% markdown-3.2.1 | 61 KB | ########################################################################################################################################## | 100% msgpack-numpy-0.4.3. | 8 KB | ########################################################################################################################################## | 100% requests-2.23.0 | 47 KB | ########################################################################################################################################## | 100% msgpack-python-0.6.2 | 89 KB | ########################################################################################################################################## | 100% certifi-2020.4.5.1 | 151 KB | ########################################################################################################################################## | 100% libstdcxx-ng-9.2.0 | 4.5 MB | ########################################################################################################################################## | 100% cymem-2.0.3 | 41 KB | ########################################################################################################################################## | 100% tk-8.6.10 | 3.2 MB | ########################################################################################################################################## | 100% libffi-3.2.1 | 47 KB | ########################################################################################################################################## | 100% tensorflow-base-1.13 | 73.9 MB | ########################################################################################################################################## | 100% murmurhash-1.0.0 | 16 KB | ########################################################################################################################################## | 100% pyopenssl-19.1.0 | 47 KB | ########################################################################################################################################## | 100% llvm-openmp-10.0.0 | 2.8 MB | ########################################################################################################################################## | 100% keras-applications-1 | 30 KB | ########################################################################################################################################## | 100% grpcio-1.23.0 | 1.1 MB | ########################################################################################################################################## | 100% pytorch-1.0.0 | 498.6 MB | ########################################################################################################################################## | 100% tensorflow-1.13.1 | 23 KB | ########################################################################################################################################## | 100% astor-0.7.1 | 22 KB | ########################################################################################################################################## | 100% toolz-0.10.0 | 46 KB | ########################################################################################################################################## | 100% readline-8.0 | 441 KB | ########################################################################################################################################## | 100% h5py-2.10.0 | 1.2 MB | ########################################################################################################################################## | 100% _openmp_mutex-4.5 | 5 KB | ########################################################################################################################################## | 100% idna-2.9 | 52 KB | ########################################################################################################################################## | 100% numpy-1.18.1 | 5.2 MB | ########################################################################################################################################## | 100% pycparser-2.20 | 89 KB | ########################################################################################################################################## | 100% thinc-6.12.1 | 1.5 MB | ########################################################################################################################################## | 100% urllib3-1.25.9 | 92 KB | ########################################################################################################################################## | 100% spacy-2.0.16 | 47.9 MB | ########################################################################################################################################## | 100% absl-py-0.9.0 | 162 KB | ########################################################################################################################################## | 100% wheel-0.34.2 | 24 KB | ########################################################################################################################################## | 100% gast-0.3.3 | 12 KB | ########################################################################################################################################## | 100% libopenblas-0.3.9 | 7.8 MB | ########################################################################################################################################## | 100% hdf5-1.10.5 | 3.1 MB | ########################################################################################################################################## | 100% ld_impl_linux-64-2.3 | 616 KB | ########################################################################################################################################## | 100% scipy-1.4.1 | 18.9 MB | ########################################################################################################################################## | 100% libprotobuf-3.11.4 | 4.8 MB | ########################################################################################################################################## | 100% openssl-1.1.1g | 2.1 MB | ########################################################################################################################################## | 100% preshed-2.0.1 | 85 KB | ########################################################################################################################################## | 100% zlib-1.2.11 | 105 KB | ########################################################################################################################################## | 100% tensorboardx-2.0 | 77 KB | ########################################################################################################################################## | 100% cytoolz-0.9.0.1 | 416 KB | ########################################################################################################################################## | 100% tensorboard-1.13.1 | 3.3 MB | ########################################################################################################################################## | 100% python_abi-3.6 | 4 KB | ########################################################################################################################################## | 100% mock-3.0.5 | 44 KB | ########################################################################################################################################## | 100% termcolor-1.1.0 | 6 KB | ########################################################################################################################################## | 100% regex-2018.01.10 | 338 KB | ########################################################################################################################################## | 100% libcurl-7.69.1 | 573 KB | ########################################################################################################################################## | 100% libblas-3.8.0 | 10 KB | ########################################################################################################################################## | 100% six-1.14.0 | 13 KB | ########################################################################################################################################## | 100% ujson-2.0.3 | 46 KB | ########################################################################################################################################## | 100% brotlipy-0.7.0 | 346 KB | ########################################################################################################################################## | 100% dill-0.2.9 | 113 KB | ########################################################################################################################################## | 100% pip-20.0.2 | 1.0 MB | ########################################################################################################################################## | 100% cryptography-2.8 | 628 KB | ########################################################################################################################################## | 100% ncurses-6.1 | 1.3 MB | ########################################################################################################################################## | 100% tqdm-4.45.0 | 48 KB | ########################################################################################################################################## | 100% cffi-1.14.0 | 221 KB | ########################################################################################################################################## | 100% _libgcc_mutex-0.1 | 3 KB | ########################################################################################################################################## | 100% libssh2-1.8.2 | 257 KB | ########################################################################################################################################## | 100% protobuf-3.11.4 | 699 KB | ########################################################################################################################################## | 100% ninja-1.10.0 | 1.9 MB | ########################################################################################################################################## | 100% pysocks-1.7.1 | 27 KB | ########################################################################################################################################## | 100% krb5-1.17.1 | 1.5 MB | ########################################################################################################################################## | 100% libgcc-ng-9.2.0 | 8.2 MB | ########################################################################################################################################## | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done Ran pip subprocess with arguments: ['/home/zhao/miniconda3/envs/squad/bin/python', '-m', 'pip', 'install', '-U', '-r', '/home/zhao/Downloads/add_self_att/condaenv.r1yix2p7.requirements.txt'] Pip subprocess output: Requirement already up-to-date: torch==1.0.0 in /home/zhao/miniconda3/envs/squad/lib/python3.6/site-packages (from -r /home/zhao/Downloads/add_self_att/condaenv.r1yix2p7.requirements.txt (line 1)) (1.0.0) # # To activate this environment, use # # $ conda activate squad # # To deactivate an active environment, use # # $ conda deactivate (base) zhao@zhao18:~/Downloads/add_self_att$ conda activate squad (squad) zhao@zhao18:~/Downloads/add_self_att$ ls args.py data environment.yml layers.py models.py __pycache__ save setup.py test.py train.py util.py (squad) zhao@zhao18:~/Downloads/add_self_att$ cd data/ (squad) zhao@zhao18:~/.../add_self_att/data$ ls dev-v2.0.json test-v2.0.json train-v2.0.json (squad) zhao@zhao18:~/.../add_self_att/data$ python setup.py python: can't open file 'setup.py': [Errno 2] No such file or directory (squad) zhao@zhao18:~/.../add_self_att/data$ cd .. (squad) zhao@zhao18:~/Downloads/add_self_att$ python setup.py Downloading GloVe word vectors... glove.840B.300d.zip: 2.18GB [17:01, 2.13MB/s] Unzipping GloVe word vectors... Downloading spacy language model... Collecting en_core_web_sm==2.0.0 Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz (37.4 MB) |████████████████████████████████| 37.4 MB 6.9 MB/s

1 reply on “How to Install Miniconda on Ubuntu 20.04”
Hello!
I’m trying to install Miniconda latest on my virtual machine with Ubuntu within. But installation stuck on
“Collecting package metadata (current_repodata.json):”
What happened on my system? All system logs are clear, no errors.