One place for hosting & domains

      Distribution

      How To Install the Anaconda Python Distribution on Ubuntu 20.04 [Quickstart]


      Introduction

      Anaconda is an open-source package manager, environment manager, and distribution of the Python and R programming languages.

      This tutorial will guide you through installing the Python 3 version of Anaconda on an Ubuntu 20.04 server. For a more detailed version of this tutorial, with more thorough explanations of each step, please refer to How To Install the Anaconda Python Distribution on Ubuntu 20.04.

      Step 1 — Retrieving the Latest Version of Anaconda

      From a web browser, find the latest version of Anaconda for Python 3 at the Anaconda Downloads page:

      https://www.anaconda.com/distribution/
      

      At the time of writing, the latest version is 2020.02, but you should use a later stable version if it is available.

      Step 2 — Downloading the Anaconda Bash Script

      Change to the /tmp directory on your Ubuntu 20.04 server as a sudo non-root user.

      Use curl to download the link that you copied from the Anaconda website. We’ll output this to a file called anaconda.sh for quicker use.

      • curl https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh --output anaconda.sh

      Step 3 — Verifying the Data Integrity of the Installer

      We can now verify the data integrity of the installer with cryptographic hash verification through the SHA-256 checksum and the script we named anaconda.sh.

      Output

      2b9f088b2022edb474915d9f69a803d6449d5fdb4c303041f60ac4aefcc208bb anaconda.sh

      You should check the output against the hashes available at the Anaconda with Python 3 on 64-bit Linux page for your appropriate Anaconda version.

      Step 4 — Running the Anaconda Script

      You’ll receive the following output to review the license agreement by pressing ENTER until you reach the end.

      Output

      Welcome to Anaconda3 2020.02 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>>

      When you get to the end of the license, type yes as long as you agree to the license to complete installation.

      Step 5 — Completing the Installation Process

      Choose the location of your installation or press ENTER to accept the default location.

      Output

      Anaconda3 will now be installed into this location: /home/sammy/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/sammy/anaconda3] >>>

      At this point, the installation process will continue. Note that it may take some time.

      Step 6 — Selecting Options

      Once installation is complete, you’ll receive the following output:

      Output

      ... installation finished. Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no] [no] >>>

      Type yes so that you can initialize Anaconda3. You’ll receive some output that states changes made in various directories along with a thank you for installing Anaconda.

      Step 7 — Activating the Installation

      You can now activate the installation by sourcing the ~/.bashrc file:

      Once you have done that, you’ll be placed into the default base programming environment.

      Step 8 — Testing the Installation

      Use the conda command to test the installation and activation:

      You’ll receive output of all the packages you have available through the Anaconda installation:

      Step 9 — Setting Up Anaconda Environments

      It’s best practice to create new environments for each of your projects. To create a Python 3 environment called my_env the syntax is as follows:

      • conda create --name my_env python=3

      Press y to verify setup.

      You can activate your new environment by typing the following:

      With your environment activated, your command prompt prefix will reflect that you are no longer in the base environment, but in the new one that you just created.

      When you’re ready to deactivate your Anaconda environment, you can do so by typing:

      Here are links to more detailed tutorials that are related to this guide:



      Source link

      How To Install the Anaconda Python Distribution on Ubuntu 20.04


      Introduction

      Anaconda is an open-source package manager, environment manager, and distribution of the Python and R programming languages. It is commonly used for data science, machine learning, large-scale data processing, scientific computing, and predictive analytics.

      Offering a collection of over 1,000 data science packages, Anaconda is available in both free and paid enterprise versions. The Anaconda distribution ships with the conda command-line utility. You can learn more about Anaconda and conda by reading the official Anaconda Documentation.

      This tutorial will guide you through installing the Python 3 version of Anaconda on an Ubuntu 20.04 server.

      Prerequisites

      Before you begin with this guide, you should have a non-root user with sudo privileges set up on your server.

      You can achieve this prerequisite by completing our Ubuntu 20.04 initial server setup guide.

      Installing Anaconda

      The best way to install Anaconda is to download the latest Anaconda installer bash script, verify it, and then run it.

      Find the latest version of Anaconda for Python 3 at the Anaconda Downloads page. At the time of writing, the latest version is 2020.02, but you should use a later stable version if it is available.

      Next, change to the /tmp directory on your server. This is a good directory to download ephemeral items, like the Anaconda bash script, which we won’t need after running it.

      Use curl to download the link that you copied from the Anaconda website. We’ll output this to a file called anaconda.sh for quicker use.

      • curl https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh --output anaconda.sh

      We can now verify the data integrity of the installer with cryptographic hash verification through the SHA-256 checksum. We’ll use the sha256sum command along with the filename of the script:

      You’ll receive output that looks similar to this:

      Output

      2b9f088b2022edb474915d9f69a803d6449d5fdb4c303041f60ac4aefcc208bb anaconda.sh

      You should check the output against the hashes available at the Anaconda with Python 3 on 64-bit Linux page for your appropriate Anaconda version. As long as your output matches the hash displayed in the sha2561 row, you’re good to go.

      Now we can run the script:

      You’ll receive the following output:

      Output

      Welcome to Anaconda3 2020.02 In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>>

      Press ENTER to continue and then press ENTER to read through the license. Once you’re done reading the license, you’ll be prompted to approve the license terms:

      Output

      Do you approve the license terms? [yes|no]

      As long as you agree, type yes.

      At this point, you’ll be prompted to choose the location of the installation. You can press ENTER to accept the default location, or specify a different location to modify it.

      Output

      Anaconda3 will now be installed into this location: /home/sammy/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/sammy/anaconda3] >>>

      The installation process will continue. Note that it may take some time.

      Once installation is complete, you’ll receive the following output:

      Output

      ... Preparing transaction: done Executing transaction: done installation finished. Do you wish the installer to initialize Anaconda3 by running conda init? [yes|no] [no] >>>

      Type yes so that you can initialize Anaconda3. You’ll receive some output that states changes made in various directories. One of the lines you receive will thank you for installing Anaconda.

      Output

      ... Thank you for installing Anaconda3! ...

      You can now activate the installation by sourcing the ~/.bashrc file:

      Once you have done that, you’ll be placed into the default base programming environment of Anaconda, and your command prompt will change to be the following:

      Although Anaconda ships with this default base programming environment, you should create separate environments for your programs and to keep them isolated from each other.

      You can further verify your install by making use of the conda command, for example with list:

      You’ll receive output of all the packages you have available through the Anaconda installation:

      Output

      # packages in environment at /home/sammy/anaconda3: # # Name Version Build Channel _ipyw_jlab_nb_ext_conf 0.1.0 py37_0 _libgcc_mutex 0.1 main alabaster 0.7.12 py37_0 anaconda 2020.02 py37_0 ...

      Now that Anaconda is installed, we can go on to setting up Anaconda environments.

      Setting Up Anaconda Environments

      Anaconda virtual environments allow you to keep projects organized by Python versions and packages needed. For each Anaconda environment you set up, you can specify which version of Python to use and can keep all of your related programming files together within that directory.

      First, we can check to see which versions of Python are available for us to use:

      You’ll receive output with the different versions of Python that you can target, including both Python 3 and Python 2 versions. Since we are using the Anaconda with Python 3 in this tutorial, you will have access only to the Python 3 versions of packages.

      Let’s create an environment using the most recent version of Python 3. We can achieve this by assigning version 3 to the python argument. We’ll call the environment my_env, but you’ll likely want to use a more descriptive name for your environment especially if you are using environments to access more than one version of Python.

      • conda create --name my_env python=3

      We’ll receive output with information about what is downloaded and which packages will be installed, and then be prompted to proceed with y or n. As long as you agree, type y.

      The conda utility will now fetch the packages for the environment and let you know when it’s complete.

      You can activate your new environment by typing the following:

      With your environment activated, your command prompt prefix will reflect that you are no longer in the base environment, but in the new one that you just created.

      Within the environment, you can verify that you’re using the version of Python that you had intended to use:

      Output

      Python 3.8.2

      When you’re ready to deactivate your Anaconda environment, you can do so by typing:

      Note that you can replace the word source with . to achieve the same results.

      To target a more specific version of Python, you can pass a specific version to the python argument, like 3.5, for example:

      • conda create -n my_env35 python=3.5

      You can inspect all of the environments you have set up with this command:

      Output

      # conda environments: # base * /home/sammy/anaconda3 my_env /home/sammy/anaconda3/envs/my_env my_env35 /home/sammy/anaconda3/envs/my_env35

      The asterisk indicates the current active environment.

      Each environment you create with conda create will come with several default packages:

      • _libgcc_mutex
      • ca-certificates
      • certifi
      • libedit
      • libffi
      • libgcc-ng
      • libstdcxx-ng
      • ncurses
      • openssl
      • pip
      • python
      • readline
      • setuptools
      • sqlite
      • tk
      • wheel
      • xz
      • zlib

      You can add additional packages, such as numpy for example, with the following command:

      • conda install --name my_env35 numpy

      If you know you would like a numpy environment upon creation, you can target it in your conda create command:

      • conda create --name my_env python=3 numpy

      If you are no longer working on a specific project and have no further need for the associated environment, you can remove it. To do so, type the following:

      • conda remove --name my_env35 --all

      Now, when you type the conda info --envs command, the environment that you removed will no longer be listed.

      Updating Anaconda

      You should regularly ensure that Anaconda is up-to-date so that you are working with all the latest package releases.

      To do this, you should first update the conda utility:

      When prompted to do so, type y to proceed with the update.

      Once the update of conda is complete, you can update the Anaconda distribution:

      Again, when prompted to do so, type y to proceed.

      This will ensure that you are using the latest releases of conda and Anaconda.

      Uninstalling Anaconda

      If you are no longer using Anaconda and find that you need to uninstall it, you should start with the anaconda-clean module, which will remove configuration files for when you uninstall Anaconda.

      • conda install anaconda-clean

      Type y when prompted to do so.

      Once it is installed, you can run the following command. You will be prompted to answer y before deleting each one. If you would prefer not to be prompted, add --yes to the end of your command:

      This will also create a backup folder called .anaconda_backup in your home directory:

      Output

      Backup directory: /home/sammy/.anaconda_backup/2020-05-06T024432

      You can now remove your entire Anaconda directory by entering the following command:

      Finally, you can remove the PATH line from your .bashrc file that Anaconda added. To do so, first open a text editor such as nano:

      Then scroll down to the end of the file (if this is a recent install) or type CTRL + W to search for Anaconda. Delete or comment out this Anaconda block:

      /home/sammy/.bashrc

      ...
      # >>> conda initialize >>>
      # !! Contents within this block are managed by 'conda init' !!
      __conda_setup="$('/home/sammy/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
      if [ $? -eq 0 ]; then
          eval "$__conda_setup"
      else
          if [ -f "/home/sammy/anaconda3/etc/profile.d/conda.sh" ]; then
              . "/home/sammy/anaconda3/etc/profile.d/conda.sh"
          else
              export PATH="/home/sammy/anaconda3/bin:$PATH"
          fi
      fi
      unset __conda_setup
      # <<< conda initialize <<<
      

      When you’re done editing the file, type CTRL + X to exit and y to save changes.

      Anaconda is now removed from your server. If you did not deactivate the base programming environment, you can exit and re-enter the server to remove it.

      Conclusion

      This tutorial walked you through the installation of Anaconda, working with the conda command-line utility, setting up environments, updating Anaconda, and deleting Anaconda if you no longer need it.

      You can use Anaconda to help you manage workloads for data science, scientific computing, analytics, and large-scale data processing. From here, you can check out our tutorials on data analysis and machine learning to learn more about various tools available to use and projects that you can do.

      We also have a free machine learning ebook available for download, Python Machine Learning Projects.



      Source link

      Choosing a Linux Distribution


      Updated by Linode

      Written by Ryan Syracuse

      What is a Distribution?

      Distributions or “distros” can be described as different operating system versions built on top of the underlying Linux Kernel to support a variety of use-cases and preferences. Since all distributions are built on Linux, most are similar and can be used interchangeably. Ubuntu, for example, is the most popular for it’s ease of use and the ability to abstract smaller configuration tasks for you by default. Arch Linux on the other hand does not provide this simplicity in favor of more control, so that you can fine tune the way that your system
      functions.

      Below is a full list of distributions that we provide, and a brief description of each:

      Distribution Description
      Alpine Lightweight distribution popular with Docker and security minded users.
      Arch Powerful and detail oriented, empowers more advanced users to fine tune their configuration.
      CentOS Widely popular in professional and business settings while still being accessible to the average user.
      CoreOS Container-focused distribution, designed for clustered deployments
      Debian One of the oldest distributions in use, popular, steady, and reliable. Regularly updated and maintained.
      Fedora Implements bleeding edge software. Fedora is similar though more advanced than CentOS and great for users who want to use the newest of the new and don’t mind an added layer of complexity.
      Gentoo Advanced distribution designed for power users who want more control over their configuration and are comfortable compiling everything from source.
      Slackware The oldest actively maintained distribution. One of the most UNIX-like Linux distributions available.
      Ubuntu Arguably the most popular Linux distribution, widely regarded for it’s ease of use.
      OpenSUSE Provides powerful tools specific to system administration tasks.

      Note

      Though this list covers most popular distributions, creating a Linode using a distribution that we do not provide is possible. Feel free to follow our Custom Distribution Guide for more information.

      Find answers, ask questions, and help others.

      This guide is published under a CC BY-ND 4.0 license.



      Source link