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.
Installing Jupyter on a server
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.