When you open GeoLab and select an environment when starting your server, you launch into a pre-configured virtual python environment. These environments typically include many commonly used geophysics tools, but we cannot include everything. Additional software and packages can be installed by users in GeoLab, with several options:
Ephemeral Installation: Due to the ephemeral nature of the JupyterHub servers, packages installed on the server will only be valid for your current session and will not persist from one session to another. You will need to reinstall them each time you log back in to GeoLab, or add them to your notebooks as magic commands.
Create a Custom Image: If you need to use the same software repeatedly, during multiple sessions, or for multiple users, you can create your own software environment and load it at launch time.
Bring Your Own Image: Many other organizations (e.g, NASA, NOAA) maintain their own JupyterHub compute environment images. Many of these will run in GeoLab.
Ephemeral Installation¶
For detailed instructions for installing packages in GeoLab see the guide
Installing python packages¶
Use pip or conda to install the package yourself at the beginning of your session by typing the below in a GeoLab Terminal.
pip install pkgname
conda install pkgnameBecause installations are ephemeral, we recommend adding these commands to your python notebooks using a magic command. This will allow the python notebook to run the bash command, and ensure you re-install the right packages each time you return to your project without having to remember to type it in the terminal.
You can add a magic command to the beginning of your notebook. The %pip / %conda forms here are better than their !pip / !conda counterparts to ensure that the package is installed to the correct directory.
%pip install pkgnameInstalling from a requirements file¶
If you have a requirements.txt or environment.yml file (e.g., from a cloned repository), you can install all listed packages at once.
From a requirements.txt file:
%pip install -r requirements.txtFrom a environment.yml file:
%conda env update --file environment.yml --name baseNote that --name base installs packages into the active base environment rather than creating a new one, which is necessary in GeoLab’s ephemeral setup. As with individual package installs, these will not persist after your session ends.
We have found that in GeoLab, pip is often faster, while conda’s dependency solver is more robust. If you encounter dependency conflict while installing with pip, try conda.
Installing ubuntu packages¶
Some software can be installed via the terminal using apt-get. Please be advised that users do not have the ability to run commands as super users: sudo will not work and these permissions cannot be granted to individual users. If you need to install something foundational, please create a custom image.
C/C++/Fortran Compilers¶
Most GeoLab images have gcc, g++, and gfortran compilers installed. You will need to move your makefiles into your home directory and compile them within GeoLab.
Create a Custom Image¶
You can build a custom own image using our existing image as a template. This strategy is an advanced approach for software with complex installations, and only recommended for users with some prior knowledge of building containers.
Follow the instructions for building a custom image in this guide.
Binder for Images¶
2i2c guide to binderhub - This strategy is an option if you want to use an environment file that extends the base GeoLab image with additional python packages, but don’t want to build and host an image. You can specify your environment file once to generate a stable container, and load that at launch time. Note, there’s a 15-20 minute overhead to build the image in GeoLab the first time and any time you change the environment file, you will need to consider whether this will save you time in the long run.
Follow the instructions to deploy a custom image from a GitHub repository using binder in this guide.
Bring Your Own Image¶
Many other organizations (e.g., NASA, NOAA, Pangeo, The Rocker Project, etc) maintain JupyterHub images with their software installed. Many of these will run in GeoLab (but we make no guarantees that images built for other platforms will work here!) We recommend using these images interdisciplinary research, where you may need software installed in another image, but want to run it on data stored in the NSF NGF archive. At Server Launch, select the ‘Other’ option from the Environment dropdown and enter the URL to the public image.