Getting Started Guide — Anaconda

Open Source Platform For Python Distribution

Ujjwal Dalmia
Towards Data Science

--

Photo by Jan Kopřiva on Unsplash

With the ever-increasing demand for Python programming language, the first task which any beginner struggles with is the setting up of the right development environment.

This tutorial aims to introduce you to Anaconda Platform, a free and open-source distribution of Python and R programming languages for scientific computing for simplifying package management and deployment.

a.) Why Anaconda?

There are multiple reasons which make Anaconda a preferred choice for learners beginning with Python:

  • A complete solution — Unlike other Python IDEs (Pycharm, Pydev, Spyder), Anaconda not only offers easy to use programming interface but also makes tasks like package management, virtual environment management simple.
  • Pre-installed Packages — The power of Python comes from thousands of packages developed by the community over the years. If working with standard Python installation, the installation of all the third-party Python packages requires pip (Python’s de-facto standard Package Management System). Anaconda takes this hassle away as it comes pre-loaded with the most commonly used Python packages.
  • Simple GUIs — Anaconda distribution comes pre-installed with the two most user-friendly Python IDEs, Jupyter Notebook (the focus of this tutorial) and Spyder.

b.) Getting Started

Listed below are simple instructions for first time Anaconda users:

1.) Download — Go to this link and select your system’s OS (Windows/ Mac/ Linux). Check your system details to identify if your system is a 64-bit or a 32-bit processor. According to the above information, download Python’s version 3.X (X being the latest version).

Anaconda Download Screen (Image by Author)

2.) Launch the installer — Installing Anaconda on Windows is as simple as installing any other software. Just launch the installer and keep clicking next next next. There are a couple of places where the installer seeks your preference. My suggestion would be to go for the installer recommended settings and not change anything. The installation will complete within 8 to 10 minutes.

3.) Launching Anaconda Prompt— Anaconda distribution, by default, installs Python and supporting software applications. You can find these applications in the Anaconda folder available in your Windows start menu. To launch the Python open application with the name Anaconda Prompt. The prompt will look as below:

Anaconda Prompt (Image by Author)

4.) Launching Python — On the Prompt, type python, and press enter. You will observe a standard text with the Python Version number coming up on the screen. Apart from that, the Prompt will also change to 3 angular brackets “>>>”. Now, you can start writing your Python code. To exit the Python environment, type exit() and press enter

Launching Python (Image by Author)

5.) A better interface — In the previous step, we looked at the Anaconda prompt that was Python’s command-line interface. Jupyter notebook is a GUI based IDE which comes packaged with Anaconda. We can launch it also from the Windows start menu folder. Since the application opens in a web browser, for users with multiple browsers, expect a prompt requesting for your preferred browser option when launching the application. The home screen will look something like below:

Jupyter Home Screen (Image by Author)

6.) Creating a new Notebook — Jupyter notebook is a one-stop-shop to write Python code, create visualizations, and write markdown documents. To create a new Notebook, click on the new drop-down on the top right corner of the home screen and click on Python 3

Launching Notebook (Image by Author)

7.) Writing your first Python code — The above step will open a notebook on a new tab in your web browser with a single cell in edit mode. Within this cell, you can write your Python program. Write a simple mathematical operation (1+2) and press shift+enter. You will see the result of the mathematical operations along with a new cell added in edit mode after the previous one. A sample screenshot for your reference below:

Jupyter Notebook (Image by Author)

8.) Shortcuts — Each Cell in the Jupyter notebook can either be in edit (with a blinking cursor and the Cell highlighted in green color) or select mode (without a cursor and the Cell highlighted in blue color). Each offers a few shortcuts for quick and easy maneuvering through the notebook:

Shortcuts irrespective of cell mode:

  • Executing code written in the current cell — Cntrl + Enter
  • Executing code written in the current cell and insert a new one below — Shift + Enter

Shortcuts when in select mode

  • Adding a new cell just before the current one— A
  • Adding a new cell just after the current cell — B
  • Cut a cell — X
  • Copy a cell — C
  • Paste a cell —V
  • Delete a cell — D..D (press D twice)
  • Undo deleted cell — Z
  • Scroll the notebook down — Spacebar
  • Scroll the notebook up — Shift + Spacebar
  • Change the cell mode from select to edit — Enter

When in edit mode

  • Exit the edit mode — Esc
  • Autocomplete Python command — Tab
  • Right indent the code — Cntrl+]
  • Left indent the code — Cntrl+[
  • Undo — Cntrl+Z
  • Redo — Cntrl+Y

c.) Closing note

I hope that the tutorial was easy to follow and you could get started with Anaconda.

Up next, learn to manage the Python environment using Anaconda.

HAPPY LEARNING ! ! ! !

--

--