Python Environment Setup#
This tutorial can be set up in two ways: GitHub Codespaces or Conda.
During the tutorial, to follow along, we recommend using GitHub Codespaces 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.
GitHub Codespaces, 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.
🐱💻 GitHub Codespaces#
Note
Indefinite Access, but Limited Resources. If your Codespace gives you a low disk space error, please refresh the tab.
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 configurations. 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).
☝️ 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:
Downloading and Installing Conda
If you don’t have Conda installed, we recommend following the instructions to download and install the Miniforge distribution >=
Miniforge3-22.3.1-0of Conda. This distribution is a minimal installer for conda specifically optimized for conda-forge (Community-led recipes, infrastructure and distributions for conda.).Create a new Conda environment called
ssec-scipy2024with theconda-lockpackage installed. This package is used to install the exact versions of the packages in theconda-lock.ymlfile.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
Activate the conda environment:
conda activate ssec-scipy2024
Download the conda lock file:
The example below uses
wgetto download the file. If you don’t havewgetinstalled, you can download the file directly from github by clicking the download () button on the right side of pagewget https://raw.githubusercontent.com/uw-ssec/docker-images/main/tutorial-scipy-2024/conda-lock.ymlInstall the packages for the tutorial using
conda-lock:conda-lock install -n ssec-scipy2024 conda-lock.yml
Clone the tutorial repository:
git clone https://github.com/uw-ssec/tutorials.git
Navigate to the tutorial directory:
cd tutorials/
Download the tutorial data with the provided
download_data.pyscript in theresourcesdirectory. 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.pyNavigate to the tutorial directory:
cd AI_Postdoc_Workshop
Run Jupyter Lab:
jupyter labNavigate to the specific tutorial notebook you would like to run. For guidance on using the Jupyter Lab interface, see the Jupyter Lab documentation.