Checking for non-preferred file/folder path names (may take a long time depending on the number of files/folders) ...

Scripts to Create Conda Environments in JupyterHub


Authors:
Owners: This resource does not have an owner who is an active HydroShare user. Contact CUAHSI (help@cuahsi.org) for information on this resource.
Type: Resource
Storage: The size of this resource is 35.2 KB
Created: May 30, 2025 at 1:58 p.m.
Last updated: Jun 03, 2025 at 5:55 p.m.
Citation: See how to cite this resource
Sharing Status: Public
Views: 26
Downloads: 0
+1 Votes: Be the first one to 
 this.
Comments: No comments (yet)

Abstract

This resource contains the following bash scripts which can be used by the user in any of the JupterHub instances accessible via the "Open with" functionality of HydroShare to create conda environment to run AORC related notebooks. In order to run any of the listed bash script files in JupyterHub, first make the file executable using the JupyterHub terminal. Here is an example:

chmod +x setup_aorc_conda_env_cuahsi_jh.sh

Then the above script can be executed from the command line as follows:

./setup_aorc_conda_env_cuahsi_jh.sh

After executing the script as above, it will create a new conda environment called 'aorc'. It will also register this new conda environment as a new Jupyter kernel with name 'Python [conda env:.conda-aorc]'. In order for any of the AORC related notebooks to use this kernel you have to first shut down all kernels and then use the option 'Change Kernel" to select this new kernel.

- setup_aorc_conda_env_cuahsi_jh.sh (This script should be used in CUAHSI JupyterHub to create a new conda environment called 'aorc')

- setup_aorc_conda_env_cybergis_jh.sh (This script should be used in CyberGIS Jupyter for Water) to create a new conda environment called 'aorc')

- environment.yml (This file contains the python modules needed to run the AORC notebooks - similar to requirements.txt file used with pip install). The above script files use this file to install the python modules specified in this yml file.

- delete_aorc_conda_env_cuahsi_jh,sh (This script can be run to delete the conda env 'aorc' in CUAHSI JupyterHub)

- delete_aorc_conda_env_cybergis_jh,sh (This script can be run to delete the conda env 'aorc' in CyberGIS Jupyter for Water)

- setup_aorc_conda_env_2i2c_jh_uv.sh (This script should be used in 2i2c JupyterHub to create a new conda environment called 'aorc')

- environment-2i2c.yml (This file is used in the above script that creates the aorc conda env in 2i2c. This environment file has few python modules for conda installation)

- requirements-2i2c.txt (This file is used in the above script that creates the aorc conda env in 2i2c to pip install most of the python modules needed for AORC notebooks.

- delete_aorc_conda_env_2i2c_jh,sh (This script can be run to delete the conda env 'aorc' in 2i2c JupyterHub)

- sample_commands_to_create_conda_env_jh.md (This file contains example commands to create a new conda environment - without using a bash script)

How to update the aorc conda environment after it has been created?
Update here means installing additional python modules or upgrading to a newer version of any modules that is already installed in the aorc conda environment. The following commands are applicable to CUAHSI and CyberGIS JH instances.

- Update the environment.yml file by adding new modules or updating the version of any modules in that file.

- In the JupyterHub instance, use a terminal and run the following 2 commands:

- conda activate aorc
- mamba env update -f environment.yml

Update aorc environment in 2i2c:
If you have updated the environments-2i2c.yml, run
- conda env update -f environment-2i2c.yml

If you have updated the requirements-2i2c.txt file, run
- pip install -r requirements-2i2c.txt

If you just want to install fe new modules or upgrade existing modules without updating environment or requirements file, then run
conda install <module-1-name> <module-2-name>
OR
pip install <module-1-name> <module-2-name>

NOTE: It is better to update environment or requirements file when there is a need to update the environment as it helps reproducibility.

Subject Keywords

Content

README.md

AORC Conda Environment Setup Scripts

This repository contains bash scripts for setting up conda environments to run AORC-related notebooks in various JupyterHub instances accessible via HydroShare's "Open with" functionality.

Usage Instructions

To use any of the bash scripts, first make them executable using the JupyterHub terminal:

bash chmod +x setup_aorc_conda_env_cuahsi_jh.sh

Then execute the script:

bash ./setup_aorc_conda_env_cuahsi_jh.sh

Available Scripts

Environment Setup Scripts

  • setup_aorc_conda_env_cuahsi_jh.sh - Creates a new conda environment 'aorc' in CUAHSI JupyterHub
  • setup_aorc_conda_env_cybergis_jh.sh - Creates a new conda environment 'aorc' in CyberGIS Jupyter for Water
  • setup_aorc_conda_env_2i2c_jh_uv.sh - Creates a new conda environment 'aorc' in 2i2c JupyterHub

Environment Cleanup Scripts

  • delete_aorc_conda_env_cuahsi_jh.sh - Deletes the 'aorc' conda environment in CUAHSI JupyterHub
  • delete_aorc_conda_env_cybergis_jh.sh - Deletes the 'aorc' conda environment in CyberGIS Jupyter for Water
  • delete_aorc_conda_env_2i2c_jh.sh - Deletes the 'aorc' conda environment in 2i2c JupyterHub

Configuration Files

  • environment.yml - Contains python modules for AORC notebooks (used by CUAHSI and CyberGIS scripts)
  • environment-2i2c.yml - Contains python modules for conda installation in 2i2c environment (used by 2i2c script)
  • requirements-2i2c.txt - Contains python modules for pip installation in 2i2c environment (used by 2i2c script)

Updating the Environment

For CUAHSI and CyberGIS JupyterHub

  1. Update the environment.yml file with new modules or version changes
  2. Run the following commands in the JupyterHub terminal: bash conda activate aorc mamba env update -f environment.yml

For 2i2c JupyterHub

For conda-managed packages: bash conda env update -f environment-2i2c.yml

For pip-managed packages: bash pip install -r requirements-2i2c.txt

Quick Updates Without File Modifications

You can directly install or upgrade modules using: ```bash conda install

or

pip install ```

Sample Commands for Manual Conda Environment Creation

  • sample_commands_to_create_conda_env_jh.md - Example commands for manual conda environment creation

Note: For better reproducibility, it's recommended to update the environment or requirements files when making changes to the environment.

How to Cite

Dash, P. (2025). Scripts to Create Conda Environments in JupyterHub, HydroShare, http://www.hydroshare.org/resource/3707b6474396455fb69c28ba58da37c0

This resource is shared under the Creative Commons Attribution CC BY.

http://creativecommons.org/licenses/by/4.0/
CC-BY

Comments

There are currently no comments

New Comment

required