Artificial IntelligenceHow to Set Up Jupyter Notebook and Other Specifications?

How to Set Up Jupyter Notebook and Other Specifications?

Jupyter Notebook refers to a web application which is open source. It is used for sharing and creating documents that comprise equations, live code, text and visualizations. People who work on Project Jupyter maintain this notebook.

This is a project spin-off from the IPython project that has a project IPython Notebook itself. Jupyter was the name given as it is the acronym of all supporting core programming languages which are Julia, Python along with R. Jupyter and IPython kernel. IPython kernel allows one to write programs in this language. However, there are more than 100 kernels which one can use too.

If you want to polish your R programming skills then you can take the EBook on R programming. It covers everything such as basic overview, data types, control structures, functions and other cool concepts.

Setting up Jupyter Notebook and running it

This notebook isn’t integrated with Python. Hence, any person wanting to try it will require installing Jupyter. Python language has numerous distributions. However, this article will go in-depth of two distributions which are idle for installing this Jupyter Notebook. One of the most popular is the CPython which is considered to be Python’s reference version. Also, it’s assumed that one uses Python 3.

● Installation

Using handy tools like pip which comes with this programming language is the way to install this notebook. For this, command script has to be $ pip install jupyter. Anaconda is Python’s second most adequate distribution. It has its tool for installation known as conda. It can be used to install packages from third-party. However, Anaconda has different sets of pre-installed scientific libraries that include Jupyter Notebook. Hence, in this case, an individual doesn’t require doing much other than installing Anaconda.

● Starting a server

To get started after installation, all a person requires to do is open up the terminal application and open a folder which he/she likes. As per recommendations, using Documents folder for starting and creating a subfolder with a name Notebooks is good as remembering it is easy. After this, move to the terminal’s location and run the command $ Jupyter notebook. This will start Jupyter, and the default browser will open a tab. This helps in running a notebook server and not a notebook itself. Next to us is creating a notebook.

Jupyter

● Making a notebook

Now that an individual successfully started a server, he/she should learn to create Notebook document too. All one requires is to press the new button present on the upper right side. It opens and offers a list of selections for simplicity. Through this article, one will learn to create documents using Python 3.

i. Naming

The top portion of this page shows Untitled. This is as no name has been given to it. One should change it as it isn’t descriptive. With the help of a mouse, one can click on Untitled word and change the name. Change it to anything that would suit one’s need.

ii. Running cells

This Notebook’s cell uses default code whenever an individual creates the first one. Also, this cell uses kernel which one chose when he/she started his/her Notebook. In this case, Python 3 was chosen to be the kernel which means a person can write Python code in his/her code cells. As one’s initial Notebook consists of just an empty cell, it can do much anything else.

Hence, to verify whether everything is working adequately, a programmer can add a Python code to a cell and run its contents. One can add the following code print( ‘hello Jupyter!’ )

Running one cell means that a person will execute that cell’s contents. To execute, one should select that cell and then click Run button which can be found on the top on buttons’ row. Also, an individual can use keyboard and press shift plus enter to execute this command. Now if multiple cells are run in the order in Notebook, then one can share variables as well as import it across cells. This helps in separating code easily into logical parts without having libraries re-imported or recreate functions or variables in every single cell.

Whenever one runs a cell, he/she can notice that some square braces next to word in towards left of cell. These square braces auto fill with numbers which indicate the order in which one ran these cells.

Jupyter Running Cells

iii. Menus

Several menus are present on Jupyter Notebook which is used for interacting with a Notebook. These menus run along Notebook’s top portion like one can find it in various other applications. Some of the recent menus include File, View, Edit, Cell, Insert, Widgets, Kernel, and Help.

iv. Starting Terminals as well as other things

Jupyter Notebook permits one to start various things other than just Notebooks. An individual can create folders, text files, or Terminal in one’s browser. Go back to the home page when one started Jupyter server first. Going to the new button will allow one to choose several other options. The terminal is one of the most interesting in this bunch as it helps in running a person’s operating system’s terminal in the browser. It allows one to run Powershell, bash, etc. in a browser. Also, it helps in running other shell commands which one might require. Also, one can view what is running on the Jupyter server’s page through the Running tab.

● Addition of rich content

This Notebook supports the addition of rich contents to the cells. Here, one will have an idea of what one can do to cells using Code and markup.

i. Cell types

Four cell types are available primarily: Markdown, Code, Heading and Raw NBConvert.
Raw NBConvert refers to a cell type which is intended for several special cases when utilizing nbconvertcommand line tool. It allows a person to control formatting in a particular way when from a format it converts to Notebook.
The heading cell is not supported anymore which can be read on the dialogue it displays saying that. Instead, a person will have to utilize Markdown for one’s heading. Primary cells one will use in this are Markdown and Code types of cells. Let’s learn about styling text using Markdown.

ii. Styling texts

Jupyter Notebook efficiently supports Markdown that is markup language which is HTML’s superset. This tutorial will show certain things one can perform with Markdown. For making a text bold, one will have to use a double asterisk or double underscore.

iii. Headers

To create headers using markdown is quite simple. One will require using the sign of humble pound. The more one uses, the size of the header will be smaller. First, it will provide a preview of it. Then running this cell will help one to get an excellently formatted header. Moreover, one can make a list using plus signs, asterisk or dashes.

iv. Syntax and code highlighting

If a programmer wants to insert any code example which end users shouldn’t be able actually to run, then insert using Markdown. For highlighting inline code one can surround the code with the backticks. If an individual inserts blocks of code, he/she can utilize triple backtracks. Also, it will specify the programming language.

● Exporting Notebook

When working with Jupyter Notebook, one will see that one requires sharing results with the non-technical personnel. When that occurs, simply one can sue nbconverter tool that comes with this Notebook. It helps in exporting as well as converting one’s Notebook into various formats. Some of these are LaTeX, HTML, RevealJS, PDF, ReStructured Text, Markdown, and Executable script.

i. Using nbconvert

This command nbconvert doesn’t take many parameters that make it easier to learn. First, one will have to open a terminal and then navigate to a folder which contains Notebook that a person desires to convert. The basic command for the conversion is $ jupyter nbconvert <input

ii. Using Menu

One can also export a running notebook by opening the File menu. Then choose the Download option. This allows one to download it in every format which the nbcovert supports. The perk of using this menu is that one doesn’t require learning how to use nbconvert. However, learning nbconvert is always better as it helps in exporting several Notebooks simultaneously that menu can’t support.

● Notebook extensions

Jupyter Notebooks comes with numerous built-in functionality. However, more can be added using extensions. Jupyter supports four distinct extension types Kernal, Notebook, IPython kernel, and Notebook server.

● What are extensions and how to install?

Extension of this is a JavaScript which helps one to load in Notebook’s frontend’s most views. If a person is quite capable of handling JavaScript, he/she can then write an extension of his/her own. Extensions help in accessing Jupyter JavaScript API and DOM of a page.

Most Jupyter extensions are installed using pip tool of Python. If pip tool doesn’t enable one to install the extension, then use the command $ jupyter nbextension install EXTENSION_NAME

However, this only enables installing an extension but not make it lives. To allow this extension to or make it live after installing run the command $ jupyter nbextension enable EXTENSION_NAME. Retarding the Jupyter Notebook will allow one to see different extensions.

The Jupyter Notebook happens to be quite handy not just for learning as well as teaching programming languages like Python but also is essential for sharing data. So, set it up today and start enjoying all the perks it has to offer.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exclusive content

- Advertisement -

Latest article

21,501FansLike
4,106FollowersFollow
106,000SubscribersSubscribe

More article

- Advertisement -