Ecosystem of Anaconda
In the preface, we mentioned that this book is designed for readers who are looking for tools in the area of data science. Existing data analysts and data science professionals who wish to improve the efficiency of their data science applications by using the best libraries with multiple languages will find this book quite useful. The platform discussed in detail across various chapters is Anaconda and the computational tools could be Python, R, Julia, or Octave. The beauty of using these programming languages is that they are all open source, as in free to download. In this chapter, we start from the very beginning: a simple introduction. For this book, we assume that readers have some basic knowledge related to several programming languages, such as R and Python. There are many books available, such as Python for Data Analysis by McKinney (2013) and Python for Finance by Yan (2017).
In this chapter, the following topics will be covered:
- Introduction
- Miniconda
- Anaconda Cloud
- Finding help
Introduction
Nowadays, we are overwhelmed by large amounts of information—see Shi, Zhang, and Khan (2017), or Fang and Zhang (2016)—the catchphrase being big data. However, defining it is still controversial, since many explanations are available. Davenport and Patil (2012) suggest that if your organization stores multiple petabytes of data, if the information most critical to your business resides in forms other than rows and columns of numbers, or if answering your biggest question would involve a mashup of several analytical efforts, you've got a big data opportunity.
Many users of data science or data analytics are learning several programming languages such as R and Python, but how can they use both of them at the same time? If John is using R while his teammate is using Python, how do they communicate with each other? How do team members share their packages, programs, and even their working environments? In this book, we try our best to offer a solution to all of these challenging tasks by introducing Anaconda, since it possesses several wonderful properties.
Generally speaking, R is a programming language for statistical computing and graphics that is supported by the R Foundation for statistical computing. Python is an interpreted, object-oriented programming language similar to Perl that has gained popularity because of its clear syntax and readability. Julia is for numerical computing and extensive mathematical function and is designed for parallelism and cloud computing, while Octave is for numerical computation and mathematics-oriented and batch-oriented language. All those four languages, R, Python, Julia, and Octave, are free.
Reasons for using Jupyter via Anaconda
In data science or data analytics, we usually work in a team. This means that each developer, researcher, or team member, might have his/her favorite programming language, such as Python, R, Octave, or Julia. If we could have a platform to run all of those languages, it would be great. Fortunately, Jupyter is such a platform, since this platform can accommodate over 40 languages, including Python, R, Julia, Octave, and Scala.
In Chapter 2, Anaconda Installation, we will show you how to run those four languages via Jupyter. Of course, there are other benefits of using Anaconda: we might worry less about the dependency of installed packages, manage packages more efficiently, and share our programs, projects, and working environments. In addition, Jupyter Notebooks can be shared with others using email, Dropbox, GitHub, and the Jupyter Notebook Viewer.
Using Jupyter without pre-installation
In Chapter 2, Anaconda Installation, we will discuss how to install Jupyter via Anaconda installation. However, we could launch Jupyter occasionally without pre-installation by going to the web page at https://jupyter.org/try:
- The welcome screen will be presented with various options for trying out different languages.
- For example, by clicking the Try Jupyter with Julia image, we would see the following screen:
- To save space, the screenshot shows only the first part of the demo. Any readers could try the previous two steps to view the whole demo. In addition, if we click the Try Jupyter with R image, the following screen would show:
- After selecting Try Jupyter with Python, you will be presented with the welcome screen for the same.
- Next, we will show you how to execute a few simple commands in R, Python, and Julia. For example, we could use R to use the platform to run a few simple command lines. In the following example, we enter pv=100, r=0.1,and n=5:
- After clicking the Run button on the menu bar, we assign those values to the three variables. Then we can estimate the future value of this present value, as illustrated here:
- Similarly, we could try to use Python, as shown here:
In the preceding example, we import the Python package called scipy and give it a short name, sp. Although other short names could be used to represent the scipy package, it is a convention to use sp. Then, we use the sqrt() function included in the Python package.
For Julia, we could try the following code (shown in the following screenshot). Again, after going to File|New on the menu, we choose Julia 0.6.0. As of May 09, 2018, 0.6.0 is the current version for Julia. Note that your current version for Julia could be different:
In the code, we define a function called sphere_vol with just one input value of r (in radians). The answer is 64.45 for an input value of 2.5.
Miniconda
Anaconda is a full distribution of Python and comes with over 1,000 open source packages after installation. Because of this, the total size is over 3 GB. Anaconda is good if we intend to have many packages downloaded and pre-installed. On the other hand, Miniconda contains only Python and other necessary libraries needed to run conda itself. The size for the Miniconda is about 400 MB, much smaller than the full version of Anaconda, so extra packages have to be downloaded and installed as requested.
There are many reasons why a new user might prefer a watered-down version of Anaconda. For example, they might not need so many packages. Another reason is that users might not have enough space. Those users could download Miniconda at https://conda.io/miniconda.html. Again, in Chapter 2, Anaconda Installation, we will discuss in detail how to install Anaconda and run programs written in different languages, such as Python, R, Julia, and Octave.
Anaconda Cloud
In Chapter 2, Anaconda Installation, we'll explain this in more detail. This function is used to collaborate with different users or group members. For example, we have a small group of ten developers working on the same project. For this reason, we have to share our programs, command datasets, and working environments, and we could use Anaconda Cloud to do so. After going to https://anaconda.org/, we will be directed to the Anaconda home page.
Note that users have to register with Anaconda before they can use this function. For example, one of the authors has the link https://anaconda.org/paulyan/dashboard. After we register, we can see the following:
Later in the book, we devote a whole chapter to this.
Finding help
There are many websites we can visit to get help. The first allows us to find the user guide, shown at the following link: https://docs.anaconda.com/anaconda/user-guide/. After we click the link, we will see four entries:
We can find lots of information by choosing one of the previous four entries. For example, after clicking Getting started with Anaconda, we will see the following information:
From the Navigator bar in the left-hand side, we could go to Tasks, and then we have the following entries:
For example, after clicking on Installing conda packages, we can see the following information (only the first part of the document is shown to save space):
For developers, we have the following links:
- Getting started: https://conda.io/docs/user-guide/getting-started.html
- Online documents: http://conda.io/docs
- Developer blog: https://www.anaconda.com/developer-blog/
- Anaconda cheat sheet: https://docs.anaconda.com/anaconda/user-guide/cheatsheet
Summary
In this chapter, we have introduced some basic concepts, such as the reasons why we use Anaconda, and the advantages of using full-fledged Anaconda and/or its baby version, Miniconda. Then, it was shown that without installing Anaconda, we could still use it by visiting a designated website. We could also test a few simple programs there, writing in R, Python, Julia, or Octave.
In Chapter 2, Anaconda Installation, we will show you how to install Anaconda and test if the installation is successful. We will look at how to launch Jupyter, how to launch Python, Spyder, and R, and how to find related help. Most of those concepts or procedures are quite basic, so readers who are confident with those basic concepts can skip this chapter, Chapter 2, Anaconda Installation, and go to Chapter 3, Data Basics, directly.
Review questions and exercises
- What is Anaconda and how do we use its platform?
- How many open source packages are accompanied with Anaconda?
- What is the home page for Anaconda?
- How do we install Anaconda? After Anaconda is installed, should we install Python separately? What about R?
- What is the size of a full Anaconda installation?
- Why should we care about Miniconda?
- What is Jupyter? How do we launch it without installation?
- What are the advantages and disadvantages of using https://jupyter.org/try?
- Where could a new learner find more useful information about Anaconda?
- Get more information about the Julia programming language.
- How do we write a simple program in Julia via Jupyter?
- How do we write a simple program in R via Jupyter?
- How do we find help for Jupyter?
- What is the conda Cheat Sheet and where can we download it?
- Could we run a simple R program without installing Anaconda?
- Could we run Anaconda without pre-installing it?
- Try the following two lines of Python code:
import numpy as np
print(np.sqrt(2))
- Try the following simple code for R:
x<-1:500
mean(x)
sd(x)
- Try the following code for Julia:
x=1:500
mean(x)
- Try the following code for R:
dd<-Sys.Date()
dd+40