Book Image

Learning Jupyter

By : Dan Toomey
Book Image

Learning Jupyter

By: Dan Toomey

Overview of this book

Jupyter Notebook is a web-based environment that enables interactive computing in notebook documents. It allows you to create and share documents that contain live code, equations, visualizations, and explanatory text. The Jupyter Notebook system is extensively used in domains such as data cleaning and transformation, numerical simulation, statistical modeling, machine learning, and much more. This book starts with a detailed overview of the Jupyter Notebook system and its installation in different environments. Next we’ll help you will learn to integrate Jupyter system with different programming languages such as R, Python, JavaScript, and Julia and explore the various versions and packages that are compatible with the Notebook system. Moving ahead, you master interactive widgets, namespaces, and working with Jupyter in a multiuser mode. Towards the end, you will use Jupyter with a big data set and will apply all the functionalities learned throughout the book.
Table of Contents (16 chapters)
Learning Jupyter
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Installing Jupyter on Windows


Jupyter requires Python to be installed (it is based on the Python language). There are a couple of tools that will automate the installation of Jupyter (and optionally Python) from a GUI. In this case, we are showing how to install using Anaconda, which is a Python tool for distributing software. You first have to install Anaconda. It is available on Windows and Mac environments. Download the executable from https://www.continuum.io/ (company that produces Anaconda) and run it to install Anaconda. The software provides a regular installation setup process, as shown in the following screenshot:

The installation process goes through the regular steps of making you agree to the distribution rights license:

The standard Windows installation allows you to decide whether all users on the machine can run the new software or not. If you are sharing a machine with different levels of users, then you can decide the appropriate action:

After clicking on Next, it will ask for a destination for the software to reside (I almost always keep the default paths):

And, most importantly, make sure that Python installed with Anaconda provides your Python basis going forward (by being placed in the execution path). Remember, Anaconda uses Python tool itself, so this is important.

Note

This process takes some time to download and install.

Once Anaconda is installed, you need to run a command-line instruction to install Jupyter. The command is as follows:

conda install jupyter

This will invoke a process to download all the necessary components for Jupyter onto your PC. Your output should look something like this:

C:\Users\Dan>conda install jupyter
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata: ....
Solving package specifications: .........
# packages in environment at C:\Users\Dan\Anaconda2:
#
jupyter                   1.0.0                    py27_2

Note

Additional lines will be present for an install. I have abbreviated the output. You now have Jupyter installed on your machine. You can start the process using the following command:

C:\Users\Dan>jupyter notebook

This command is starting a Jupyter Notebook server on your machine. Once the server is started, a browser instance will be opened at the starting point of the notebook. You should see logging statements similar to the following on your machine as the server starts:

[I 16:21:59.144 NotebookApp] Writing notebook server cookie secret to C:\Users\Dan\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[I 16:21:59.846 NotebookApp] Serving notebooks from local directory: C:\Users\Dan
[I 16:21:59.846 NotebookApp] 0 active kernels
[I 16:21:59.846 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 16:21:59.862 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Once Jupyter is running, you will notice a running icon for Jupyter (two inverted crescents) at the bottom of your screen:

Note, the last line of the log is the instruction you must use to stop the server (press Ctrl + C in the command-line window where the server is running).

If you press Ctrl + C in that window, the Jupyter server will shut down gracefully:

[W 17:26:36.688 NotebookApp] 404 GET /favicon.ico (::1) 62.00ms referer=None
[W 17:26:36.750 NotebookApp] 404 GET /favicon.ico (::1) 0.00ms referer=None
[I 17:28:24.891 NotebookApp] Interrupted...
[I 17:28:24.891 NotebookApp] Shutting down kernels

You will notice that the Anaconda package has been installed on your application menu for further use: