How to Install Python Anaconda and Miniconda in CentOS 7

To Install Python Anaconda and Miniconda in CentOS 7

Basically, all the major Linux distributions come up with a base Python package. If you update the core interpreter, it might affect certain OS utilities. However, if you use a third-party distribution, you are free to add/remove packages and update python as much as you want and your os will remain fully operational. In this tutorial, you will be briefed about the method to install  Python Anaconda and Miniconda in CentOS 7. 

 

Installing Python Anaconda

A minimum of 3GB disk space is required to download and install Anacondo and all its packages. So, first download the Anaconda installer. 

Depending upon preferred python version, you can download the anaconda installer. Here python 3.6 for 64-bit  architecture is downloaded. 

[root@linuxhelp ~]# wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh
--2018-02-08 21:48:29--  https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh
Resolving repo.continuum.io (repo.continuum.io)... 104.16.18.10, 104.16.19.10, 2400:cb00:2048:1::6810:120a, ...
.
Saving to: ‘ Anaconda3-5.0.0.1-Linux-x86_64.sh.1’ 

100%[===================================================================================================> ] 549,434,488  761KB/s   in 10m 52s

 

 

Once you' ve downloaded the installer, you can open up a terminal and run it. You can run the installer using shell command sh just like this.

Towards the end, when it asks if you want to perpend Anaconda to your OS’ s PATH variable, select ‘ Yes’ . This will make running Conda commands a lot easier

root@linuxhelp ~]# sh Anaconda3-5.0.0.1-Linux-x86_64.sh
The installer will then begin and proceed with a series of questions.
Do you accept the license terms? [yes|no]
[no] > > > 
Please answer ' yes'  or ' no' :' 
> > >  yes

Anaconda3 will now be installed into this location:
/root/anaconda3

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

[/root/anaconda3] > > >  /usr/local/anaconda/
PREFIX=/usr/local/anaconda

Do you wish the installer to prepend the Anaconda3 install location
to PATH in your /root/.bashrc ? [yes|no]
[no] > > >  yes

Appending source /usr/local/anaconda/bin/activate to /root/.bashrc
A backup will be made to: /root/.bashrc-anaconda3.bak


For this change to become active, you have to open a new terminal.

Thank you for installing Anaconda3!

To make the changes take effect, close and then re-open your Terminal window.

 

 

Our next step is to test our installation. To test your installation, in your Terminal window run the command

[root@linuxhelp ~]# conda list
# packages in environment at /usr/local/anaconda:
#
_ipyw_jlab_nb_ext_conf    0.1.0            py36he11e457_0
alabaster                 0.7.10           py36h306e16b_0
anaconda                  5.0.0.1          py36hfb0b618_1
.
.
zict                      0.1.2            py36ha0d441b_0
zlib                      1.2.11               hfbfcf68_1

If your installation is successful, then it will list all the installed packages in the alphabetical order just like above. 

 

You can confirm with the newly installed Python location by just typing the command

[root@linuxhelp ~]# which python
/usr/local/anaconda/bin/python

 

Or the following command. 

[root@linuxhelp ~]# python -V
Python 3.6.2 :: Anaconda, Inc.

Anaconda is ready to be used. 

By using conda command we can easily manage the packages.

[root@linuxhelp ~]# conda update python
anaconda: 5.0.0.1-py36hfb0b618_1 -->  custom-py36_0
conda: 4.3.27-py36h2866c0b_0 -->  4.3.29-py36ha26b0c0_0
python: 3.6.2-hdfe5801_15 -->  3.6.3-hc9025b9_1

Proceed ([y]/n)? y

 

 

Installing Miniconda

For a smaller server environment with a minimum capacity less than 3GB disk space. Download the Miniconda installer by using the following command. 

[root@linuxhelp ~]# wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh

 

Once it is downloaded, you shall run the following command to install it. 

[root@linuxhelp ~]# sh Miniconda3-latest-Linux-x86_64.sh

Welcome to Miniconda3 4.3.31

In order to continue the installation process, please review the license

.
installation finished.
Do you wish the installer to prepend the Miniconda3 install location
to PATH in your /root/.bashrc ? [yes|no]
[no] > > >  yes

Appending source /root/miniconda3/bin/activate to /root/.bashrc
A backup will be made to: /root/.bashrc-miniconda3.bak

For this change to become active, you have to open a new terminal.

Thank you for installing Miniconda3!

To make the changes take effect, just make sure to close and re-open your Terminal window. 

 

If you want to check Miniconda, run the conda comment. 

[root@linuxhelp ~]# conda list
.
.
zict                      0.1.2            py36ha0d441b_0
zlib                      1.2.11               hfbfcf68_1

If your installation is successful, then it will list all the installed packages in the alphabetical order as above.

 

Uninstalling Python Anaconda/Miniconda

To uninstall Python Anconda/Miniconda, you can just remove the installation folder and remove the environment variables set in .bashrc file. For my installation, it will be just like this.

[root@linuxhelp ~]# rm -rf /usr/local/anaconda/
[root@linuxhelp ~]# rm -rf /usr/local/miniconda/

 

And finally, you can edit the ~/.bashrc file and remove the following entries added for Anaconda/Miniconda directory from your PATH environment variable

[root@linuxhelp ~]# export PATH=" /usr/local/anaconda/bin:$PATH" 
[root@linuxhelp ~]# export PATH=" /root/miniconda3/bin:$PATH" 

By installing this distribution, you’ re free to add or remove packages and update Python to any new versions as you want, without interfering with your underlying OS.

FAQ
Q
Where to download the repo for anaconda?
A
use the link to get download the source package of anaconda "https://repo.continuum.io/archive/".
Q
What is the default path for installing Anaconda?
A
Windows : C:\Users\\Anaconda3\
macOS: /Users//anaconda3
Linux: /home//anaconda3
Q
What is Python Anaconda?
A
Anaconda is a free and open source distribution of the Python and R programming languages for data science and machine learning related applications, that aims to simplify package management and deployment. Package versions are managed by the package management system conda.
Q
How do I get Anaconda with Python 3.5 or 3.6?
A
There are three ways to get Anaconda with Python 3.5 or 3.6:

We recommend that you download the latest version of Anaconda and then make a Python 3.5 (or 3.6) environment.
Or download the latest version of Anaconda and run the following command to install Python 3.5 (or 3.6) in the root environment: conda install python=3.5
or

conda install python=3.6

Or download the most recent Anaconda installer that included Python 3.5 (Anaconda 4.2.0) or Python 3.6 (Anaconda 5.2.0). You can download either of these from our archive. Scroll down the page until you find the version you need for your platform.
Q
How tio install Theano using anaconda?
A
To install Theano with acceleration:

On Windows, run conda install theano.
On Linux and macOS run conda install gcc theano.

NOTE: Theano is available from the default Anaconda channels for Windows, macOS and Linux with the command conda install theano.