Installing Anaconda in GNU/Linux Mint

Download Miniconda

Download Miniconda for Python version 3 (we would be able to run both Python major versions). The URL for Miniconda download is https://docs.conda.io/en/latest/miniconda.html where you should choose the option for 64-bit Linux.
1
[email protected]:~$ cd Downloads
2
[email protected]:~/Downloads$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
3
--2020-03-24 19:13:28-- https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
4
Resolving repo.anaconda.com (repo.anaconda.com)... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8303, ...
5
Connecting to repo.anaconda.com (repo.anaconda.com)|104.16.130.3|:443... connected.
6
HTTP request sent, awaiting response... 200 OK
7
Length: 85055499 (81M) [application/x-sh]
8
Saving to: β€˜Miniconda3-latest-Linux-x86_64.sh’
Copied!

Run the installer

1
[email protected]:~/Downloads$ bash Miniconda3-latest-Linux-x86_64.sh
2
​
3
Welcome to Miniconda3 4.8.2
4
​
5
In order to continue the installation process, please review the license
6
agreement.
7
Please, press ENTER to continue
8
>>>
Copied!
Accept the default installation directory /home/curro/Miniconda3 and let the installer initialize Miniconda3.
Open a new terminal and it will have the base environment activated. Update conda in this new terminal
1
(base) [email protected]:~$ conda update conda
2
Collecting package metadata (current_repodata.json): done
3
Solving environment: done
4
​
5
## Package Plan ##
6
​
7
environment location: /home/curro/miniconda3
8
​
9
added / updated specs:
10
- conda
11
​
12
​
13
The following packages will be downloaded:
14
​
15
package | build
16
---------------------------|-----------------
17
certifi-2019.11.28 | py37_1 156 KB
18
conda-4.8.3 | py37_0 2.8 MB
19
idna-2.9 | py_1 49 KB
20
openssl-1.1.1e | h7b6447c_0 2.5 MB
21
pycparser-2.20 | py_0 92 KB
22
requests-2.23.0 | py37_0 92 KB
23
setuptools-46.1.1 | py37_0 512 KB
24
tqdm-4.43.0 | py_0 56 KB
25
------------------------------------------------------------
26
Total: 6.3 MB
27
​
28
The following packages will be UPDATED:
29
​
30
certifi 2019.11.28-py37_0 --> 2019.11.28-py37_1
31
conda 4.8.2-py37_0 --> 4.8.3-py37_0
32
idna pkgs/main/linux-64::idna-2.8-py37_0 --> pkgs/main/noarch::idna-2.9-py_1
33
openssl 1.1.1d-h7b6447c_4 --> 1.1.1e-h7b6447c_0
34
pycparser pkgs/main/linux-64::pycparser-2.19-py~ --> pkgs/main/noarch::pycparser-2.20-py_0
35
requests 2.22.0-py37_1 --> 2.23.0-py37_0
36
setuptools 45.2.0-py37_0 --> 46.1.1-py37_0
37
tqdm 4.42.1-py_0 --> 4.43.0-py_0
38
​
39
​
40
Proceed ([y]/n)?
41
​
42
​
43
Downloading and Extracting Packages
44
openssl-1.1.1e | 2.5 MB | ################################################################################################################### | 100%
45
requests-2.23.0 | 92 KB | ################################################################################################################### | 100%
46
conda-4.8.3 | 2.8 MB | ################################################################################################################### | 100%
47
pycparser-2.20 | 92 KB | ################################################################################################################### | 100%
48
idna-2.9 | 49 KB | ################################################################################################################### | 100%
49
setuptools-46.1.1 | 512 KB | ################################################################################################################### | 100%
50
certifi-2019.11.28 | 156 KB | ################################################################################################################### | 100%
51
tqdm-4.43.0 | 56 KB | ################################################################################################################### | 100%
52
Preparing transaction: done
53
Verifying transaction: done
54
Executing transaction: done
Copied!

Create Python 2 and Python 3 environments.

Now we proceed to create a Python 2 and a Python 3 environment.
1
(base) [email protected]:~$ conda create --name py3 python=3
2
Collecting package metadata (current_repodata.json): done
3
Solving environment: done
4
​
5
## Package Plan ##
6
​
7
environment location: /home/curro/miniconda3/envs/py3
8
​
9
added / updated specs:
10
- python=3
11
​
12
​
13
The following packages will be downloaded:
14
​
15
package | build
16
---------------------------|-----------------
17
certifi-2019.11.28 | py38_1 157 KB
18
pip-20.0.2 | py38_1 1.7 MB
19
python-3.8.1 | h0371630_1 49.5 MB
20
setuptools-46.1.1 | py38_0 513 KB
21
wheel-0.34.2 | py38_0 51 KB
22
------------------------------------------------------------
23
Total: 51.8 MB
24
​
25
The following NEW packages will be INSTALLED:
26
​
27
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
28
ca-certificates pkgs/main/linux-64::ca-certificates-2020.1.1-0
29
certifi pkgs/main/linux-64::certifi-2019.11.28-py38_1
30
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.33.1-h53a641e_7
31
libedit pkgs/main/linux-64::libedit-3.1.20181209-hc058e9b_0
32
libffi pkgs/main/linux-64::libffi-3.2.1-hd88cf55_4
33
libgcc-ng pkgs/main/linux-64::libgcc-ng-9.1.0-hdf63c60_0
34
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-9.1.0-hdf63c60_0
35
ncurses pkgs/main/linux-64::ncurses-6.2-he6710b0_0
36
openssl pkgs/main/linux-64::openssl-1.1.1e-h7b6447c_0
37
pip pkgs/main/linux-64::pip-20.0.2-py38_1
38
python pkgs/main/linux-64::python-3.8.1-h0371630_1
39
readline pkgs/main/linux-64::readline-7.0-h7b6447c_5
40
setuptools pkgs/main/linux-64::setuptools-46.1.1-py38_0
41
sqlite pkgs/main/linux-64::sqlite-3.31.1-h7b6447c_0
42
tk pkgs/main/linux-64::tk-8.6.8-hbc83047_0
43
wheel pkgs/main/linux-64::wheel-0.34.2-py38_0
44
xz pkgs/main/linux-64::xz-5.2.4-h14c3975_4
45
zlib pkgs/main/linux-64::zlib-1.2.11-h7b6447c_3
46
​
47
​
48
Proceed ([y]/n)?
49
​
50
​
51
Downloading and Extracting Packages
52
python-3.8.1 | 49.5 MB | ################################################################################################################### | 100%
53
setuptools-46.1.1 | 513 KB | ################################################################################################################### | 100%
54
wheel-0.34.2 | 51 KB | ################################################################################################################### | 100%
55
certifi-2019.11.28 | 157 KB | ################################################################################################################### | 100%
56
pip-20.0.2 | 1.7 MB | ################################################################################################################### | 100%
57
Preparing transaction: done
58
Verifying transaction: done
59
Executing transaction: done
60
#
61
# To activate this environment, use
62
#
63
# $ conda activate py3
64
#
65
# To deactivate an active environment, use
66
#
67
# $ conda deactivate
Copied!
The Python 2 environment is created in the same way.

Installing software in a given environment

1
(base) [email protected]:~$ conda activate py3
2
(py3) [email protected]:~$ conda install ipython numpy matplotlib pandas jupyter
3
Collecting package metadata (current_repodata.json): done
4
Solving environment: done
5
​
6
## Package Plan ##
7
​
8
environment location: /home/curro/miniconda3/envs/py3
9
​
10
added / updated specs:
11
- ipython
12
- jupyter
13
- matplotlib
14
- numpy
15
- pandas
16
​
17
​
18
The following packages will be downloaded:
19
​
20
package | build
21
---------------------------|-----------------
22
attrs-19.3.0 | py_0 39 KB
23
backcall-0.1.0 | py38_0 21 KB
24
.
25
.
26
.
27
y
28
libgfortran-ng-7.3.0 | 1006 KB | ################################################################################################################### | 100%
29
gmp-6.1.2 | 514 KB | ################################################################################################################### | 100%
30
Preparing transaction: done
31
Verifying transaction: done
32
Executing transaction: done
Copied!

Your first jupyter notebook

You can launch a notebook with the command
1
(py3) [email protected]:~$ jupyter notebook
2
[I 19:43:36.145 NotebookApp] Writing notebook server cookie secret to /home/curro/.local/share/jupyter/runtime/notebook_cookie_secret
3
[I 19:43:37.193 NotebookApp] Serving notebooks from local directory: /home/curro
4
[I 19:43:37.194 NotebookApp] The Jupyter Notebook is running at:
5
[I 19:43:37.195 NotebookApp] http://localhost:8888/?token=42d493626e94c6f5c1ae2d7cdcd300075b584cbe20b62f72
6
[I 19:43:37.196 NotebookApp] or http://127.0.0.1:8888/?token=42d493626e94c6f5c1ae2d7cdcd300075b584cbe20b62f72
7
[I 19:43:37.196 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
8
[C 19:43:37.283 NotebookApp]
9
​
10
To access the notebook, open this file in a browser:
11
file:///home/curro/.local/share/jupyter/runtime/nbserver-6617-open.html
12
Or copy and paste one of these URLs:
13
http://localhost:8888/?token=42d493626e94c6f5c1ae2d7cdcd300075b584cbe20b62f72
14
or http://127.0.0.1:8888/?token=42d493626e94c6f5c1ae2d7cdcd300075b584cbe20b62f72
15
[I 19:43:45.541 NotebookApp] Creating new notebook in
16
[I 19:43:45.572 NotebookApp] Writing notebook-signing key to /home/curro/.local/share/jupyter/notebook_secret
17
[I 19:43:47.232 NotebookApp] Kernel started: 9ab7c66b-92db-4e3e-a137-9900af586546
18
[I 19:45:47.214 NotebookApp] Saving file at /Untitled.ipynb
Copied!
By default you can only access notebooks and directories below the folder from which you run the jupyter notebook command, but not files above this folder. You can alter this default behavior and other jupyter default config options editing the application config file as in the following example.
You first generate a config file for your notebooks
1
(py3) [email protected]:~$ jupyter notebook --generate-config
2
Writing default config to: /home/curro/.jupyter/jupyter_notebook_config.py
3
(py3) [email protected]:~$ ls ~/.jupyter/
4
jupyter_notebook_config.py
Copied!
This file contains the default configuration of jupyter. In order to create a folder and make this directory the default working directory for our notebooks, you can proceed as follows (not recommended unless you are positive all of your notebooks will be contained in this folder and its subfolders
1
(py3) [email protected]:~$ mkdir ~/Python
Copied!
You should then open the jupyter_notebook_config.py file in a text editor and replace the line
1
#c.NotebookApp.notebook_dir = ''
Copied!
by
1
c.NotebookApp.notebook_dir = 'ISP/Python'
Copied!

Keeping your Anaconda install updated

The most important command in this case is
1
conda update --all
Copied!
This will update all packages in the current environment. You can also update a selected package or packages (and dependencies) as follows
1
conda update numpy scipy
Copied!
Again this will only affect the current environment.
Last modified 2yr ago