Anaconda is an alternative to virutalenv and venv. Its lightweight, easy to use, and highly portable. It is available for a variety of operating systems, but for the purpose of this guide, we will be using Ubuntu 18.04.
There is no apt package available so we will install it using bash.
Open your terminal or putty session and do the following:
sudo su mkdir /download cd /download
To make sure you get the most up to date release, copy the download url from Anaconda directly. Use wget to download the file and sha256sum to ensure the file is authentic. Its important in this case since its an executable download.
wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh --no-check-certificate sha256sum Anaconda3-2020.02-Linux-x86_64.sh #Output Should Be: 2b9f088b2022edb474915d9f69a803d6449d5fdb4c303041f60ac4aefcc208bb Anaconda3-2020.02-Linux-x86_64.sh
To verify the hash with Anaconda, follow the link below:
Enter the following commands:
chmod 755 Anaconda3-2020.02-Linux-x86_64.sh su ./Anaconda3-2020.02-Linux-x86_64.sh
After running the commands follow the prompts. Hit enter to scroll through them. Say yes at the end to agree with the terms. Anaconda will ask if you want to install in your user directory which should look like /home/username/anaconda3 unless you have a different configuration.
Anaconda shouldn’t be installed in the root directory. Switch to your regular user as shown above or make sure you specify the proper user path when prompted- as illustrated below:
Anaconda3 will now be installed into this location: /home/administrator/anaconda3 Press ENTER to confirm the location Press CTRL-C to abort the installation Or specify a different location below [/home/administrator/anaconda3] >>> /home/ryan/anaconda3
At the end of the installation, it will ask you if you would like to initialize Anaconda. If you hit enter it will default to no. Type yes and hit enter.
Preparing transaction: done Executing transaction: done installation finished. Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no] >>> yes
Activate it by running:
Navigate to the directory you where you want to use conda to create a virtual environment. If you use Python 2 or a different version of Python 3 you will need to change it when using conda create.
conda create --name env python=3.6 Proceed ([y]/n)? y #This starts Anaconda - env can be changed to yourname conda activate env #This stops Anaconda conda deactivate #Create an environment spec list (for same OS) conda list --explicit > spec-list.txt #To recreate the environment: conda create --name python-course --file spec-list.txt