Jupyter Notebooks.

What are they and how do they work? In the past I made use of iPython, but while I have heard often how wonderful Jupyter notebooks are, as I start writing this page, I just do not ‘grok’ them. This page will evolves as my understanding does. As such, this page is for people new Jupyter- for now very new, as it is still a work in progress.

  • Installation
  • Introduction Videos
  • Running Jupyter Notebooks or Jupyter Lab

Installation.

Jupyter notebooks require Python, but by installation is to allow for both Python and Kotlin code within the notebooks. For installation, references exist already, including:

I already had python installed, but jupyter notebook? A pip list revealed it was already installed, so an update was needed.

The ‘bash’ or ‘Powershell/cmd’ commands Iused were:

python -m pip list
python -m pip install --upgrade jupyterlab
python -m pip install --upgrade kotlin-jupyter-kernel
cd <path to a folder>
jupyter notebook

From this point some introductory videos may be useful.

That was all that is required to install and run. The pip list is not required at all and i only ran it to check what was already installed, which in my case was an older version of jupyterlab but no kotlin-jupyter-kernel. The –upgrade is only required for packages already installed, but the upgrade option ensures the install will always, whether or no there is anything to upgrade.

The command jupyter notebook will launch a server, on socked 8888 if available, otherwise on the first available socket following 8888. The server must continue running to use jupyter (so don’t close that window). A web page will be opened on the server ready to start playing. More notes on running notebooks later.

Introduction Videos

This introductory video is a good start. I will add more over time as useful ones are discovered.

Running Jupyter Notebook or Jupyter Lab

There are refereces to both ‘Jupyter Notebook’ and Jupyter Lab’. These are simply two user interfaces to the same tool. The newer interface is the ‘lab’ interface, but you can change interface at any time, and in any given browser tab you may use either interface.

For a simple topic. this is a lot of text on just running the programs to use jupyter notebooks, but the goal is to leave nothing unexplained.

The file executable file ‘jupyter‘ (eg jupyter.exe) is installed in the python folder (for the version of python used to run pip), so provided the python folder is in the path, the shell command ‘jupyter’ is available immediately following install. Use the command jupyter notebook and the server will launch a notebook style browser window by the default, or jupyter lab to have a lab window by default. Leave the server running while working with jupyter. The server will use 8888 if available, or the first available socket following 8888.

The current folder (current directory or ‘cd’) for the shell used to launch jupyter, will be the root of the file tree for all windows accessing that server. Only files within that directory can be accessed. However multiple copies of jupyter serve can be open at once, each on a different port, providing access to different points within the overall file tree. Of course, for example, jupyter is launched from a users home directory, then all files within that directory will be accessible using just one server, although all paths will then start from the home directory.

To access each of the two different interfaces is the same following either the ‘jupyter lab’ or the ‘jupyter notebook’ commands (although initally open one browswer tab with the interface first specified) :

Uses of Jupyter Notebooks

to follow – note this is a background project, and the page will be updated over the next few weeks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s