How to Install Anaconda Python Distribution on Debian 10
Anaconda is an open-source distribution of the Python and R programming languages that can be used to simplify package management and deployment. Anaconda is the most popular Python data science distribution and leading in open source innovation for machine learning. Anaconda provides more than 1,500 packages that are suitable for Windows, Linux, and MacOS. It is specially designed for large-scale data processing, scientific computing and predictive analytics.
In this tutorial, we will learn how to install the Anaconda Python Distribution on Debian 10. We will also learn how to create a new environment with a specific Python version, update the Anaconda and uninstall the Anaconda.
Requirements
- A server running Debian 10.
- A root password is set up to your server.
Getting Started
Before starting, you will need to update your system with the latest version. You can do this by running the following command:
apt-get update -y
apt-get upgrade -y
Once your server is updated, restart your server to apply the changes.
Download Anaconda
By default, Anaconda is not available in the package repository of Debian 10. So, you will need to download it from the official website of Anaconda Python.
You can download the Anaconda installer script with the following command:
wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
Once the download is completed, you will need to verify the integrity of the installer using SHA-256 checksum:
Run the following command to verify it:
sha256sum Anaconda3-2019.03-Linux-x86_64.sh
You should get the following output:
45c851b7497cc14d5ca060064394569f724b67d9b5f98a926ed49b834a6bb73a Anaconda3-2019.03-Linux-x86_64.sh
Next, open your web browser and visit the Anaconda Page for your appropriate Anaconda version. You should see the following page:
Now, verify the hash printed from the command above matches the one available in the above page. If the hash matches on this page, you can proceed to the next step.
Install Anaconda
Now, start the Anaconda installation by running the following script:
bash Anaconda3-2019.03-Linux-x86_64.sh
You should see the welcome screen and term of license screen:
Welcome to Anaconda3 2019.03
In order to continue the installation process, please review the license
agreement.
Please, press ENTER to continue
>>>
===================================
Do you accept the license terms? [yes|no]
>>> yes
Type yes and hit Enter to accept the license. You should see the following output:
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
Now, specify the location of Anaconda or hit Enter to proceed with the default location. You should see the following output:
installing: statsmodels-0.9.0-py37h035aef0_0 ...
installing: seaborn-0.9.0-py37_0 ...
installing: anaconda-2019.03-py37_0 ...
installation finished.
Do you wish the installer to initialize Anaconda3
by running conda init? [yes|no]
[no] >>> yes
Type Yes to initialize Anaconda3. You should see the following output:
==> 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 Anaconda3!
===========================================================================
Anaconda and JetBrains are working together to bring you Anaconda-powered
environments tightly integrated in the PyCharm IDE.
PyCharm for Anaconda is available at:
https://www.anaconda.com/pycharm
Now, activate the Anaconda installation with the following command:
source ~/.bashrc
You should see the following output:
(base) root@debian:~#
Check Anaconda Installation
Anaconda is now installed on your system. You can check the information of current Anaconda with the following command:
(base) root@debian:~# conda info
You should get the following output:
active environment : base
active env location : /root/anaconda3
shell level : 1
user config file : /root/.condarc
populated config files :
conda version : 4.6.11
conda-build version : 3.17.8
python version : 3.7.3.final.0
base environment : /root/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /root/anaconda3/pkgs
/root/.conda/pkgs
envs directories : /root/anaconda3/envs
/root/.conda/envs
platform : linux-64
user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Linux/4.19.0-5-amd64 debian/10 glibc/2.28
UID:GID : 0:0
netrc file : None
offline mode : False
You can also list the packages available with Anaconda with the following command:
(base) root@debian:~# conda list
You should see the following output:
# packages in environment at /root/anaconda3:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0
alabaster 0.7.12 py37_0
anaconda 2019.03 py37_0
anaconda-client 1.7.2 py37_0
anaconda-navigator 1.9.7 py37_0
anaconda-project 0.8.2 py37_0
asn1crypto 0.24.0 py37_0
astroid 2.2.5 py37_0
astropy 3.1.2 py37h7b6447c_0
Update Anaconda
It is recommended to update the Anaconda package to the latest version. If you want to update the Anaconda, first you will need to update the conda utility:
(base) root@debian:~# conda update conda
You should see the following output:
Collecting package metadata: done
Solving environment: done
## Package Plan ##
environment location: /root/anaconda3
added / updated specs:
- conda
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-4.7.11 | py37_0 3.0 MB
conda-package-handling-1.3.11| py37_0 260 KB
------------------------------------------------------------
Total: 3.2 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
conda-package-han~ pkgs/main/linux-64::conda-package-handling-1.3.11-py37_0
The following packages will be UPDATED:
conda 4.6.11-py37_0 --> 4.7.11-py37_0
Proceed ([y]/n)? y
Type y and hit Enter to update the conda. Once the conda is updated, run the following command to update the Anaconda distribution
(base) root@debian:~# conda update anaconda
Type yes and hit Enter when prompted to update the Anaconda.
Configure Anaconda Environments
With Anaconda environment, you can easily organize projects based on Python versions and packages. You can use a different version of Python for each project.
You can search the available Python versions you can use with the following command:
(base) root@debian:~# conda search "^python$"
You should see a list of different Python versions including both Python 2 and Python 3 versions.
Let’s start to create a new environment named test_env for Python 3:
(base) root@debian:~# conda create --name test_env python=3
This command will download all the packages for the virtual environment and alert you once finished.
Next, activate your environment with the following command:
(base) root@debian:~# conda activate test_env
You should get the following environment:
(test_env) root@debian:~#
Now, verify your Python version with the following command:
(test_env) root@debian:~# python --version
You should see the following output:
Python 3.7.4
Now, deactivate from your Anaconda environment with the following command:
(test_env) root@debian:~# conda deactivate
Next, create a new environment named test_env36 for Python 3.6 with the following command:
(base) root@debian:~# conda create -n test_env36 python=3.6
Next, activate your environment with the following command:
(base) root@debian:~# conda activate test_env36
You should get the following environment:
(test_env36) root@debian:~#
You can list all your environment with the following command:
(test_env36) root@debian:~# conda info --envs
You should see the following output:
# conda environments:
#
base /root/anaconda3
test_env /root/anaconda3/envs/test_env
test_env36 * /root/anaconda3/envs/test_env36
Next, deactivate for your environment with the following command:
(test_env36) root@debian:~# conda deactivate
If you want to remove your Anaconda environment, run the following command:
conda env remove -n test_env
conda env remove -n test_env36
Uninstall Anaconda
You can uninstall Anaconda with all the configuration files using the anaconda-clean module. First, install anaconda-clean module with the following command:
conda install anaconda-clean
Type yes and hit Enter to complete the installation. Next, run the following command to uninstall Anaconda from your system:
Anaconda-clean
Type yes and hit Enter to uninstall Anaconda. This command will also create a new backup directory .anaconda_backup in your home directory.
After uninstalling Anaconda, you will also need to remove the Anaconda root directory. You can delete it with the following command:
rm -rf ~/anaconda3
Next, open the .bashrc file and delete the Anaconda PATH variable line:
nano ~/.bashrc
Remove the following lines:
# added by Anaconda3 installer
export PATH="/root/anaconda3/bin:$PATH"
Save and close the file when you are finished.
Conclusion
Congratulations! you have successfully installed Anaconda Python on Debian 10. I hope you can now easily create new Python project and manage data in large-scale and scientific computing. For more information, you can visit the Anaconda official documentation at Anaconda Doc.
Đăng ký liền tay Nhận Ngay Bài Mới
Subscribe ngay
Cám ơn bạn đã đăng ký !
Lỗi đăng ký !
Add Comment