Python Environment Setup

Python Environment Setup#

This tutorial can be set up in three ways: Nebari, GitHub Codespaces, or Conda.

During the tutorial, to follow along, we recommend using Nebari for ease of use, as you won’t need to worry about setting up the compute environment. However, if you would like to set up the tutorial on your local machine, you can use Conda.

Another option is to use GitHub Codespaces, which is a cloud-based development environment that’s hosted in the cloud. This option is available indefinitely, but you will be limited in the free resources you can use with GitHub Codespaces.

🪴 Nebari#

Note

Day of Access Only, with a good amount of resources

For ease of use, we recommend using Nebari. The Nebari platform is a cloud-based platform that provides a JupyterLab Interface. Nebari is developed and hosted by Quansight. It is a great way to run the tutorial materials without having to install anything on your local machine. However, this will only be available on the day of the tutorial ONLY. You will receive a coupon code with details to access Nebari.

You can find details about using Nebari in the Participant Guide.

🐱‍💻 GitHub Codespaces#

Note

Indefinite Access, but Limited Resources

This tutorial is available to run within Github Codespaces - “a development environment that’s hosted in the cloud” - with the conda packages specification in the conda-lock.yml file. However, you will be limited in the free resources you can use with GitHub Codespaces and you need to have a GitHub account to use GitHub Codespaces.

A codespace is a development environment that’s hosted in the cloud. You are able to chose from various Dev container configuration, for this specific workshop, please ensure that Scipy2024 is selected. GitHub currently gives every user 120 vCPU hours per month for free, beyond that you must pay. So be sure to explicitly stop or shut down your codespace when you are done by going to this page (codespaces).

Open in GitHub Codespaces

☝️ Click the button above to go to options window to launch a Github codespace.

🐍 Conda#

Note

Most Persistent, but requires local setup that take time and may differ from the tutorial environment

You can set up the tutorial locally using a Conda environment. Here’s how:

  1. Downloading and Installing Conda

    If you don’t have Conda installed, we recommend following the instruction to downloadn and install the Miniforge distribution >= Miniforge3-22.3.1-0 of Conda. This distribution is a minimal installer for conda specifically optimized for conda-forge (Community-led recipes, infrastructure and distributions for conda.).

  2. Create a new Conda environment called ssec-scipy2024 with conda-lock package installed. This package is used to install the exact versions of the packages in the conda-lock.yml file.

    Note: Ensure that you are using Python Version 3.11. The command below will install a clean conda environment with just Python 3.11, conda-lock, and their dependencies

    conda create --yes -n ssec-scipy2024 python=3.11 conda-lock
    
  3. Activate the conda environment:

    conda activate ssec-scipy2024
    
  4. Download the conda lock file:

    The example below uses wget to download the file. If you don’t have wget installed, you can download the file directly from github by clicking the download () button on the right side of page

    wget https://raw.githubusercontent.com/uw-ssec/docker-images/main/tutorial-scipy-2024/conda-lock.yml
    
  5. Install the packages for the tutorial using conda-lock:

    conda-lock install -n ssec-scipy2024 conda-lock.yml
    
  6. Clone the tutorial repository:

    git clone https://github.com/uw-ssec/tutorials.git
    
  7. Navigate to the tutorial directory:

    cd tutorials/
    
  8. Download the tutorial data with the provided download.py script in the resources directory. This includes the OLMo data, copy of the vector database, and others. The data are downloaded to ~/.cache/ssec-tutorials/ directory:

    python resources/download_data.py
    
  9. Navigate to the tutorial directory:

    cd SciPy2024
    
  10. Run Jupyter Lab:

    jupyter lab
    
  11. Navigate to the specific tutorial notebook you would like to run. For guidance on using the Jupyter Lab interface, see the Jupyter Lab documentation.