Introduction To Anaconda and Python Installation and Setup
Introduction To Anaconda and Python Installation and Setup
Abstract Python has become one of the most popular programming languages for research in the Acting Editor
past decade. Its free, open-source nature and vast online community are some of the reasons be- Nareg Berberian
(University of Ot-
hind its success. Countless examples of increased research productivity due to Python can be found
tawa)
across a plethora of domains online, including data science, artificial intelligence and scientific re-
search. This tutorial’s goal is to help users get started with Python through the installation and setup Reviewers
Tarique Siragy (Uni-
of the Anaconda software. The goal is to set users on the path toward using the Python language by versity of Ottawa)
preparing them to write their first script. This tutorial is divided in the following fashion: a small
introduction to Python, how to download the Anaconda software, the different content that comes
with the installation, and a simple example related to implementing a Python script.
Keywords Python, Psychology, Installation guide, Anaconda. Tools Python, Anaconda.
10.20982/tqmp.16.5.S003
Figure 1 Available Anaconda distribution installation packages across platforms and processor type.
paradigms and record participant’s answers accordingly and Pages for writing text, but in truth they are so much
(PsychoPy; Knorr, Marxen, & Petzold, 2019). These are just more. IDEs contain many useful features to write, edit
a few examples of how Python can be used in psychology and debug code, visualize and inspect data, store variables,
to speed up research at every step and how it can allow for present results, and collaborate on projects. While the dis-
more powerful analyses and research models. play and the quirks of an IDE differ, the programming lan-
So why learn Python? It can save you time, increase guage does not. Thus, changing IDEs in Anaconda does not
control over your experiments, allow your imagination to result in drastically changing your Python code. The learn-
be the limit of your research designs and because it can ing curve is mostly related to understanding Python’s syn-
optimize your research productivity. With such objectives tax. Once you learn how to code in one IDE, you will be
in mind, this tutorial was designed to get you started as able to transfer this skill to another with ease. One IDE
fast as possible by explaining how to install the most op- is not necessarily better than another, each comes with its
timal packages with the Anaconda distribution tool kit. own pros and cons and which one you choose comes down
We cover how to use these packages, important terminol- to personal preference.
ogy, how to employ various Python interfaces, and how to Downloading the toolkit also provides you with an
implement your first few lines of code, effectively build- enormous selection of prebuilt functions that the Python
ing your first program and preparing you for the next few community has coded in the past. These functions are re-
steps in learning Python. grouped in what are called libraries and can be down-
loaded easily through Anaconda. There are many different
Anaconda
ways to install and use Python on your computer, but Ana-
What is Anaconda? Anaconda is a free software that pro- conda is a simple, well-supported, graphical user inter-
vides you with a toolkit that is tailored for research and face (GUI) that includes the most important libraries and
science. Installing Anaconda gives you access to different IDEs in its installation. Anaconda also simplifies the pro-
environments that allow you to code in either Python or cess of keeping all of these libraries up to date. Thus, rather
R. These environments, also known as integrated devel- than installing Python separately with different IDEs, li-
opment environments (IDEs), are platforms or apps that braries and functionalities, Anaconda can do it for you in
greatly ease the development of code. They serve a simi- one installation.
lar role to text processors like Microsoft Word, Google Doc As mentioned on their website, Anaconda is “the eas-
(a) Welcome Screen (b) Read/accept license agrement (c) Installation type
(d) Choosing location for installation (e) Advanced installation options (f) Finish installation and close wizard
(a) Welcome Screen (b) Read/accept license agrement (c) Installation type
(d) Choosing location for installation (e) Advanced installation options (f) Finish installation and close wizard
IDE would be best suited for your current needs. “Run” to execute your code and display the output in
For simplicities’ sake, this tutorial will use Jupyter Note- the console. This should result in two things. First, your
book to demonstrate how to write your first program in console should display your code’s output. Second, a
Python! Now enough of the dry explanation, let’s get cod- new cell should appear beneath it (see Fig 9). Congrat-
ing! ulations on this first step! You are now a Python pro-
grammer and are ready to explore the new horizons
Writing Your First Program
that await you!
First off, open Jupyter Notebook through the Anaconda * Note: to access your Jupyter Notebook again or any
navigator. This should result in your default internet other .ipynb files, you must open them from the main
browser opening and the display should resemble Figure Jupyter Notebook screen (Figure 6). Simply clicking on
6 (where all of your device’s files should be available to ac- them from the desktop or other files will result in an er-
cess). Select the desired destination and follow the steps to ror message.
create your first Python script.
Next Steps
1. Select “New” and choose the “Python 3” option to open
a new Script/Notebook (see Fig. 6). Now that you have started programming, there might be
2. Once the notebook is created, in the top left corner, se- questions or projects that you encounter requiring some
lect the “Untitled” name and rename the notebook for extra help. A great resource for those situations is Stack
convenience (see Fig. 7). Overflow. This free forum for developers allows you to
3. In the first cell, enter the following lines of code exactly ask questions and get reliable help quickly. It also has
as it is shown in the editor (see Fig. 8). While writing, a large repository of previously asked questions that you
you may notice certain aspects of the code will change can navigate. Another important resource to explore is
colours. This will be elaborated further in a subsequent GitHub. This is a website for storing, sharing and hosting
tutorial. code that can be downloaded by other programmers. In
4. Once everything is properly entered in the editor, press other words, GitHub allows users to share their scripts and
Figure 5 Basic Components of Three Different IDEs, the Console (A), Editor (B), Variable Explorer (C) and Help (E) are
displayed in each IDE they apply to.
Terminology
API : Application Programming Interface is a computing interface which defines interactions between multiple software
intermediaries.
GUI : Graphical User Interface is a form of user interface that allows users to interact with electronic devices through
graphical icons and audio indicators, such as primary notation, instead of text-based user interfaces, typed command
labels or text navigation.
IDE : An Integrated Development Environment is a software application that provides comprehensive facilities to com-
puter programmers for software development. An IDE normally consists of at least a source code editor, build automation
tools, and a debugger.
Library : Collection of packages, i.e., Numpy, Matplotlib, Seaborn and Tensorflow.
Package : Collection of modules.
Module : A set of functions, types, classes, etc. Anything ending in .py.
Console : A console (also called a “shell”) is a command line interpreter that takes input from the user and interprets it.
Cannot save or store information.
(b)
(a)
Editor : A code editor is a tool that is used to write and edit code. It will save and store information as scripts. When
running its code, the output is usually displayed in the console.
Citation
Rolon-Mérette, D., Ross, M., Rolon-Mérette, T., & Church, K. (2020). Introduction to Anaconda and Python: Installation and
setup. The Quantitative Methods for Psychology, 16(5), S3–S11. doi:10.20982/tqmp.16.5.S003
Copyright © 2020, Rolon-Mérette, Ross, Rolon-Mérette, and Church. This is an open-access article distributed under the terms of the Creative Commons
Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) or licensor are credited
and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is
permitted which does not comply with these terms.