Home

How to Use Anaconda for Machine Learning

|
|  Updated:  
2021-04-12 14:24:14
|   From The Book:  
No items found.
TensorFlow For Dummies
Explore Book
Buy On Amazon
You can use a number of packages to perform machine learning tasks. This article tells you how to obtain your copy of Anaconda, the Anaconda3-2020.07 version. Here's a brief overview of Anaconda as a product.

How to download Anaconda

The basic Anaconda package is a free download that you obtain at Anaconda.com. Simply click Download to see the list of available downloads, then click the individual link for your platform to obtain access to the free product. Anaconda supports the following platforms:
  • Windows 32-bit and 64-bit (the installer may offer you only the 64-bit or 32-bit version, depending on which version of Windows it detects)
  • Linux 64-bit (x86 and PowerPC 8/9 installers)
  • Mac OS X 64-bit (graphical and command line installer)
In all cases, you want the Anaconda3-2020.07 version of the product. If you can’t find the correct version on the main Anaconda page, you can obtain it at the Anaconda archive.

The installation works best if you first remove previous versions of Anaconda from your system. Otherwise, one version of the product can interfere with other versions of the product. Anaconda provides a separate uninstall program in the Anaconda executable folder on your system, the location of which can vary. For example, to uninstall a previous version of Anaconda 3 on a Windows system, look in the C:\Users\\Anaconda3 folder on your system for Uninstall-Anaconda3.exe. Execute this file to uninstall the product.

The default download version installs Python 3.8. Both Windows and Mac OS X provide graphical installers. When using Linux, you rely on the bash utility.

Why Anaconda for machine learning?

Anaconda isn’t an Integrated Development Environment (IDE) like many other products out there. Rather, it’s a centralized method of accessing a number of packages. (Use Jupyter Notebook as an IDE because it supports literate programming techniques.)

Anaconda helps you manage both IDEs, along with a wealth of other packages. In addition, you can create environments for using the IDEs in specific ways. For example, you could have an environment for using Jupyter Notebook for Python and an entirely different environment for using Jupyter Notebook for R.

So, it’s important to know why this article is emphasizing Jupyter Notebook when Anaconda provides access to a number of IDEs. Most IDEs look like fancy text editors, and that’s precisely what they are. Yes, you get all sorts of intelligent features, hints, tips, code coloring, and so on, but at the end of the day, they’re all text editors. Nothing is wrong with text editors, and this article isn’t telling you anything of the sort. However, given that Python developers often focus on scientific applications that require something better than pure text presentation, using notebooks instead can be helpful.

A notebook differs from a text editor in that it focuses on a technique called literate programming, advanced by Stanford computer scientist Donald Knuth. You use literate programming to create a kind of presentation of code, notes, math equations, and graphics. In short, you wind up with a scientist’s notebook full of everything needed to understand the code completely. You commonly see literate programming techniques used in high-priced packages such as Mathematica and MATLAB. Notebook development excels at

  • Demonstration
  • Collaboration
  • Research
  • Teaching objectives
  • Presentation
The Anaconda tool collection provides you with a great Python coding experience but also helps you discover the enormous potential of literate programming techniques. If you spend a lot of time performing scientific tasks, Anaconda and products like it are essential. In addition, Anaconda is free, so you get the benefits of the literate programming style without the cost of other packages.

For more information about Anaconda and changes from previous editions, make sure to view the Release Notes. Most of the changes you find deal with bug fixes and updates.

How to install Anaconda on Linux

You use the command line to install Anaconda on Linux—there is no graphical installation option. The following procedure should work fine on any Linux system, whether you use the Intel or PowerPC version of Anaconda:
  1. Open a copy of Terminal. The Terminal window appears.
  2. Change directories to the downloaded copy of Anaconda on your system. The name of this file varies, but normally it appears as Anaconda3-2020.07-Linux-x86_64.sh for Intel systems and Anaconda3-2020.07-Linux-ppc64le.sh for PowerPC systems. The version number is embedded as part of the filename. In this case, the filename refers to version 3.2020.07, which is the version used for this book. If you use some other version, you may experience problems with the source code and need to make adjustments when working with it.
  3. Type bash Anaconda3-2020.07-Linux-x86_64.sh (for the Intel version) or bash Anaconda3-2020.07-Linux-ppc64le.sh (for the PowerPC version) and press Enter. An installation wizard starts that asks you to accept the licensing terms for using Anaconda.
  4. Read the licensing agreement and accept the terms using the method required for your version of Linux. The wizard asks you to provide an installation location for Anaconda. The book assumes that you use the default location for your platform. If you choose some other location, you may have to modify some procedures later in the book to work with your setup.
  5. Provide an installation location (if necessary) and press Enter (or click Next). The application extraction process begins. The installer asks whether you want to initialize Anaconda3 using the conda init command.
  6. Type yes and press Enter or click Yes. After the extraction is complete, you see a completion message.
  7. Add the installation path to your PATH statement using the method required for your version of Linux. You’re ready to begin using Anaconda.

How to install Anaconda on Mac OS X

The Mac OS X installation comes in only one form: 64-bit. The following steps help you install Anaconda 64-bit on a Mac system using the GUI method:
  1. Locate the downloaded copy of Anaconda on your system. The name of this file varies, but normally it appears as Anaconda3-2020.07-MacOSX-x86_64.pkg. The version number is embedded as part of the filename. In this case, the filename refers to version 3.2020.07. If you use some other version, you may experience problems with the source code and need to make adjustments when working with it.
  2. Double-click the installation file. An introduction dialog box appears.
  3. Click Continue. The wizard asks whether you want to review the Read Me materials. You can read these materials later. For now, you can safely skip the information.
  4. Click Continue. The wizard displays a licensing agreement. Be sure to read through the licensing agreement so that you know the terms of usage.
  5. Click I Agree if you agree to the licensing agreement. The wizard asks you to provide a destination for the installation. The destination controls whether the installation is for an individual user or a group.
  6. Click Continue.
  7. Click Install. The installation begins. A progress bar tells you how the installation process is progressing. When the installation is complete, you see a completion dialog box.
  8. Click Continue. You’re ready to begin using Anaconda.

How to install Anaconda on Windows

Anaconda comes with a graphical installation application for Windows, so getting a good install means using a wizard, as you would for any other installation. The following procedure should work fine on any Windows system, whether you use the 32-bit or the 64-bit version of Anaconda:
  1. Locate the downloaded copy of Anaconda on your system. The name of this file varies, but normally it appears as Anaconda3-2020.07-Windows-x86.exe for 32-bit systems and Anaconda3-2020.07-Windows-x86_64.exe for 64-bit systems. The version number is embedded as part of the filename. In this case, the filename refers to version 3.2020.07, which is the version used for this book. If you use some other version, you may experience problems with the source code and need to make adjustments when working with it.
  2. Double-click the installation file. You see a Welcome dialog box that tells you which version of Anaconda you have—32-bit or 64-bit. Make sure you have the correct one.
  3. Click Next. The wizard displays a licensing agreement. Be sure to read through the licensing agreement so that you know the terms of usage.
  4. Click I Agree if you agree to the licensing agreement. You’re asked what sort of installation type to perform, as shown. In most cases, you want to install the product just for yourself.

    Anaconda install wizard Tell the wizard how to install Anaconda on your system.
  5. Choose one of the installation types and then click Next. The wizard asks where to install Anaconda on disk. The book assumes that you use the default location. If you choose some other location, you may have to modify some procedures later in the book to work with your setup.
  6. Choose an installation location (if necessary) and then click Next. You see the Advanced Installation Options, shown. These options are selected by default, and no good reason exists to change them in most cases. The book assumes that you’ve set up Anaconda using the default options.

    Anaconda advanced options Configure the advanced installation options.
  7. Change the advanced installation options (if necessary) and then click Install. You see an Installing dialog box with a progress bar. The installation process can take a few minutes, so get yourself a cup of coffee and read the comics for a while. When the installation process is over, you see a Next button enabled.
  8. Click Next. (If you see a page with a link for PyCharm, click Next again.) The wizard tells you that the installation is complete. This page includes options for the Anaconda tutorial and learning more about Anaconda. If you keep them selected, you see the appropriate pages loaded into your browser.
  9. Click Finish. You’re ready to begin using Anaconda.

About This Article

This article is from the book: 

No items found.

About the book author:

John Paul Mueller is a freelance author and technical editor. He has writing in his blood, having produced 100 books and more than 600 articles to date. The topics range from networking to home security and from database management to heads-down programming. John has provided technical services to both Data Based Advisor and Coast Compute magazines.

Luca Massaron is a data scientist specialized in organizing and interpreting big data and transforming it into smart data by means of the simplest and most effective data mining and machine learning techniques. Because of his job as a quantitative marketing consultant and marketing researcher, he has been involved in quantitative data since 2000 with different clients and in various industries, and is one of the top 10 Kaggle data scientists.