From d492e886f3594bc9999473a4d848b0d1e20a13b5 Mon Sep 17 00:00:00 2001 From: Amy Defnet Date: Mon, 23 Mar 2026 16:29:38 -0400 Subject: [PATCH 1/3] load conda before creating env in codespace --- .devcontainer/devcontainer.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b7ab2a8..fd91484 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,11 +1,9 @@ { "name": "CSSI Evaluation Workshop", "image": "mcr.microsoft.com/devcontainers/miniconda:3", - // Create the conda environment (includes editable package install + notebook extras), // register the Jupyter kernel, and activate the env in every new terminal session. - "postCreateCommand": "conda env create -f cssi_env.yml && conda run -n cssi_evaluation python -m ipykernel install --user --name=cssi_evaluation --display-name='Python (cssi_evaluation)' && echo 'conda activate cssi_evaluation' >> ~/.bashrc", - + "postCreateCommand": "source /opt/conda/etc/profile.d/conda.sh && conda env create -f cssi_env.yml && conda run -n cssi_evaluation python -m ipykernel install --user --name=cssi_evaluation --display-name='Python (cssi_evaluation)' && echo 'source /opt/conda/etc/profile.d/conda.sh' >> ~/.bashrc && echo 'conda activate cssi_evaluation' >> ~/.bashrc", "customizations": { "vscode": { "extensions": [ @@ -20,4 +18,4 @@ } } } -} +} \ No newline at end of file From 40f46c2c1963821349975d496dd9012c54150916 Mon Sep 17 00:00:00 2001 From: Amy Defnet Date: Mon, 23 Mar 2026 16:55:50 -0400 Subject: [PATCH 2/3] try micromamba installation --- .devcontainer/devcontainer.json | 27 ++++++++++++++------------- cssi_env.yml | 1 + 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fd91484..c1754fe 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,20 +1,21 @@ { - "name": "CSSI Evaluation Workshop", - "image": "mcr.microsoft.com/devcontainers/miniconda:3", - // Create the conda environment (includes editable package install + notebook extras), - // register the Jupyter kernel, and activate the env in every new terminal session. - "postCreateCommand": "source /opt/conda/etc/profile.d/conda.sh && conda env create -f cssi_env.yml && conda run -n cssi_evaluation python -m ipykernel install --user --name=cssi_evaluation --display-name='Python (cssi_evaluation)' && echo 'source /opt/conda/etc/profile.d/conda.sh' >> ~/.bashrc && echo 'conda activate cssi_evaluation' >> ~/.bashrc", + "name": "CSSI Evaluation Dev", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + + // Install Micromamba through Dev Containers Features + "features": { + "ghcr.io/devcontainers/features/micromamba:1": { + "version": "latest" + } + }, + + // Ensure the environment is created and the kernel is installed + "postCreateCommand": "eval \"$(micromamba shell hook --shell=bash)\" && micromamba activate base && micromamba env create -f cssi_env.yml && micromamba run -n cssi_evaluation python -m ipykernel install --user --name=cssi_evaluation --display-name='Python (cssi_evaluation)' && echo \"eval '$(micromamba shell hook --shell=bash)'\" >> ~/.bashrc && echo \"micromamba activate cssi_evaluation\" >> ~/.bashrc", + "customizations": { "vscode": { - "extensions": [ - "ms-python.python", - "ms-toolsai.jupyter", - "ms-toolsai.jupyter-keymap", - "ms-toolsai.vscode-jupyter-slideshow" - ], "settings": { - "python.defaultInterpreterPath": "/opt/conda/envs/cssi_evaluation/bin/python", - "jupyter.notebookFileRoot": "${workspaceFolder}" + "python.defaultInterpreterPath": "/home/vscode/.local/bin/python" } } } diff --git a/cssi_env.yml b/cssi_env.yml index 5eb3c04..5b1542f 100644 --- a/cssi_env.yml +++ b/cssi_env.yml @@ -1,6 +1,7 @@ name: cssi_evaluation channels: - conda-forge +channel_priority: strict dependencies: - python=3.10 - pip From 54e1b65a0519538bebe2d404eb1097c2f58288b4 Mon Sep 17 00:00:00 2001 From: Amy Defnet Date: Mon, 23 Mar 2026 17:18:48 -0400 Subject: [PATCH 3/3] add source and specify bash commands --- .devcontainer/devcontainer.json | 27 +++++++++++++-------------- cssi_env.yml | 1 - 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c1754fe..79618ec 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,21 +1,20 @@ { - "name": "CSSI Evaluation Dev", - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", - - // Install Micromamba through Dev Containers Features - "features": { - "ghcr.io/devcontainers/features/micromamba:1": { - "version": "latest" - } - }, - - // Ensure the environment is created and the kernel is installed - "postCreateCommand": "eval \"$(micromamba shell hook --shell=bash)\" && micromamba activate base && micromamba env create -f cssi_env.yml && micromamba run -n cssi_evaluation python -m ipykernel install --user --name=cssi_evaluation --display-name='Python (cssi_evaluation)' && echo \"eval '$(micromamba shell hook --shell=bash)'\" >> ~/.bashrc && echo \"micromamba activate cssi_evaluation\" >> ~/.bashrc", - + "name": "CSSI Evaluation Workshop", + "image": "mcr.microsoft.com/devcontainers/miniconda:3", + // Create the conda environment (includes editable package install + notebook extras), + // register the Jupyter kernel, and activate the env in every new terminal session. + "postCreateCommand": "bash -lc \"source /opt/conda/etc/profile.d/conda.sh && conda env create -f cssi_env.yml && conda run -n cssi_evaluation python -m ipykernel install --user --name=cssi_evaluation --display-name='Python (cssi_evaluation)' && echo 'source /opt/conda/etc/profile.d/conda.sh' >> ~/.bashrc && echo 'conda activate cssi_evaluation' >> ~/.bashrc\"", "customizations": { "vscode": { + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.vscode-jupyter-slideshow" + ], "settings": { - "python.defaultInterpreterPath": "/home/vscode/.local/bin/python" + "python.defaultInterpreterPath": "/opt/conda/envs/cssi_evaluation/bin/python", + "jupyter.notebookFileRoot": "${workspaceFolder}" } } } diff --git a/cssi_env.yml b/cssi_env.yml index 5b1542f..5eb3c04 100644 --- a/cssi_env.yml +++ b/cssi_env.yml @@ -1,7 +1,6 @@ name: cssi_evaluation channels: - conda-forge -channel_priority: strict dependencies: - python=3.10 - pip