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 to Jupyter, as the page is still a work in progress.
- Installation
- Introduction Videos
- Shell: Running Jupyter Notebooks or Jupyter Lab
- Windows: From The Start Menu
- Uses Of Jupyter Notebooks
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:
- Jax page for a clean installation of python including Jupyter Notebooks with Kotlin
- Or more flexible options allowing for python or other components already installed:
- Jupytier.org installation page
- JetBrains Kotlin blog post on Kotlin with Jupyter notebooks
- Or for just playing with examples already online
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 for saving files>
jupyter notebook
From this point some introduction videos may be useful (see below).
That was all that is required to install and run, launching from ‘start’ is covered below. The pip list
is not required, I only ran it to check what was already installed, which in my case was an older version of jupyterlab
, but I had no kotlin-jupyter-kernel
. The –upgrade is only required for packages already installed, but the upgrade
option ensures the install
will always work, whether or not there is anything to upgrade.
The command jupyter notebook
will launch a server, on socket 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 experimenting. 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.
Shell: 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) :
- http://localhost:8888/lab
- opens a browser tab with the newer ‘jupyter lab’ interface
- http://localhost:8888/tree
- opens a tab with the older/simpler notebook interface showing the file tree
- http://localhost:8888/notebooks/<path to individual notebook>
- opens a browser tab with an individual notebook displayed using the notebook interface
Windows: From The Start Menu
Idle can easily be launched as app from the windows start menu. Further steps are needed to bring that same functionality to jypyter. First, choose a folder to install a launcher. I suggest python folder, but the folder could be anywhere.
Add the following as a .bat file, which could be done by creating a .txt document then renaming it later. I called the file jupyter.bat
cd <path to chosen directory for files e.g. %HOMEPATH%\Jupyter>
jupyter notebook
Now create a shortcut (new shortcut) to launch the bat file within a command shell.
Uses of Jupyter Notebooks
to follow – note this is a background project, and the page will be updated over the next few weeks