Intro to JupyterHubs

Goals

In this lab, you will get an overview of our JupyterHub

  • Log into the JupyterHub
  • Open RStudio
  • Understand the directory structure
  • Restart your JupyterHub server
  • Start/Stop your JupyterHub server

Log into the JupyterHub

Go to https://itcoocean.2i2c.cloud/. Click “Login to continue”. You will be asked to log in with your GitHub Account, if you are not logged in already.

ITCOocean JupyterHub Login

Image type: Python or R

Next you select your image type. We have two different R images and two Python images. The default is “Geospatial R with SDM”. This is an image with geospatial libraries and species distribution libraries.

Virtual Machine size

You’ll see something similar to this that allows you to choose a large virtual machine if your project needs it. For the tutorials, you will only need the Small Virtual Machine. Please only choose the large machines if you run out of RAM as the larger machines cost us more.

Machine Profiles

Start up

After we select our server type and click on start, JupyterHub will allocate our instance using Amazon Web Services (AWS). This may take several minutes.

Jupyterhub Spawning

Open RStudio

When you are in the Jupyter Lab tab (note the Jupyter Logo), you will see a Launcher page. If you don’t see this, go to File > New Launcher.

Jupyterhub Launcher
  • Open RStudio by clicking on the “RStudio” box in the Launcher tab:

RStudio We will be mainly using RStudio in this course.

End your session

When you are finished working for the day it is important to log out of the JupyterHub. When you keep a session active it uses up AWS resources (costs money) and keeps a series of virtual machines deployed.

Caution

You log out from the Jupyter Lab tab not the RStudio tab.

From the Jupyter Lab tab, do one of two things to stop the server:

  • Log out File -> Log Out and click “Log Out”!
  • or File -> Hub Control Panel -> Stop My Server
Tip

Can’t find the Jupyter Lab tab? Go to https://itcoocean.2i2c.cloud/hub/home

Restart your server

Sometimes the server will crash/stop. This can happen if too many people use a lot of memory all at once. If that happens, go to the Jupyter Lab tab and then File -> Hub Control Panel -> Stop My Server and then Start My Server. You shouldn’t lose your work unless you were uploading a file.

Your files

When you start your server, you will have access to your own virtual drive space. No other users will be able to see or access your files. You can upload files to your virtual drive space and save files here. You can create folders to organize your files. You personal directory is home/jovyan. Everyone has the same home directory but your files are separate and cannot be seen by others.

There are a number of different ways to create new files. We will practice this in the RStudio lecture.

Will I lose all of my work?

Logging out will NOT cause any of your work to be lost or deleted. It simply shuts down some resources. It would be equivalent to turning off your desktop computer at the end of the day.

Shared files

Shared folder

In the file panel, you will see a folder called shared. These are read-only shared files that we have prepared for you. There are two main folders:

  • data The folder with data files
  • 2023-Hackbook The full Git repository with the files for https://hackweek-itcoocean.github.io/2023-Hackbook

You will also see shared-public. This is a read-write folder for you to put files for everyone to see and use. You can create a team folder here for shared data and files. Note, everyone can see and change these so be careful to communicate with your team so multiple people don’t work on the same file at the same time. You can also create folders for each team member and agree not to change other team members files.

You will also see other folders of Python content for the Python users. We will have a separate introduction to Jupyter Notebooks.

**Python users

You can open a Jupyter Notebook by clicking on the “Python 3” box. In the Launcher tab:

Jupyterhub Launcher

Jupyter notebooks are a very common way to share Python code and tutorials. Because we are focusing on R in this course, we will not use Jupyter notebooks much but we have many Juptyer notebooks that you can experiment with in the python-tutorials folder. Get an overview of Jupyter Lab: Intro to Jupyter Lab Learn about the geosciences tools in Python

Note: Python users can run Python in RStudio and R users can run R in Jupyter Notebooks.

FAQ

Can we use Matlab with JupyterHub? You can use Octave kernel as a Matlab replacement. It is open source and free. If you want to integrate Matlab, there is a project to do so jupyter-matlab-proxy

Why do we have the same home directory as /home/jovyan? /home/jovyan is the default home directory for ‘jupyter’ based images/dockers. It is the historic home directory for Jupyter deployments.

Can other users see the files in my /home/jovyan folder? No, other users can not see your credentials.

Acknowledgements

Some sections of this document have been taken from hackweeks organized by the University of Washington eScience Institute and Openscapes.