Reader small image

You're reading from  Jupyter Cookbook

Product typeBook
Published inApr 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788839440
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Dan Toomey
Dan Toomey
author image
Dan Toomey

Dan Toomey has been developing application software for over 20 years. He has worked in a variety of industries and companies, in roles from sole contributor to VP/CTO-level. For the last few years, he has been contracting for companies in the eastern Massachusetts area. Dan has been contracting under Dan Toomey Software Corp. Dan has also written R for Data Science, Jupyter for Data Sciences, and the Jupyter Cookbook, all with Packt.
Read more about Dan Toomey

Right arrow

Installing Jupyter on a server


The term server has changed over time to mean several things. We are interested in a machine that will have multiple users accessing the same software concurrently. Jupyter Notebooks can be run by multiple users. However, there is no facility to separate the data for one user from another. Standard Jupyter installations only expect and account for one user. If we have a Notebook that allows for data input from the user, then the data from different users will be intermingled in one instance and possibly displayed incorrectly.

How to do it...

See the following example in this section.

Example Notebook with a user data collision

We can see an example of a collision with a Notebook that allows for data entry from a user and responds with incorrect results:

  • I call upon an example that I have used elsewhere for illustration. For this example, we will use a simple Notebook that asks the user for some information and changes the display to use that information:
from ipywidgets import interact
def myfunction(x):
    return x
interact(myfunction, x= "Hello World ");
  • The script presents a textbox to the user, with the original value of the box containing the Hello World string.
  • As the user interacts with the input field and changes the value, the value of the variable x in the script changes accordingly and is displayed on screen. For example, I have changed the value to the letter A:
  • We can see the multiuser problem if we open the same page in another browser window (copy the URL, open a new browser window, paste in the URL, and hit Enter). We get the exact same display—which is incorrect. We expected the new window to start with a new script, just prompting us with the default Hello World message. However, since the Jupyter software expects only one user, there is only one copy of the variable x; thus, it displays its value A.

We can have a Notebook server that expects multiple users and separates their instances from each other without the annoying collisions occurring. A Notebook server includes the standard Jupyter Notebook application that we have seen, but a server can also include software to distinguish the data of one user from another. We'll cover several examples of this solution in Chapter 8, Multiuser Environments.

Previous PageNext Chapter
You have been reading a chapter from
Jupyter Cookbook
Published in: Apr 2018Publisher: PacktISBN-13: 9781788839440
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Dan Toomey

Dan Toomey has been developing application software for over 20 years. He has worked in a variety of industries and companies, in roles from sole contributor to VP/CTO-level. For the last few years, he has been contracting for companies in the eastern Massachusetts area. Dan has been contracting under Dan Toomey Software Corp. Dan has also written R for Data Science, Jupyter for Data Sciences, and the Jupyter Cookbook, all with Packt.
Read more about Dan Toomey