Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly define conda environments #49

Closed
ManavalanG opened this issue Apr 8, 2022 · 4 comments
Closed

Explicitly define conda environments #49

ManavalanG opened this issue Apr 8, 2022 · 4 comments

Comments

@ManavalanG
Copy link
Member

Conda environments are currently implicitly defined with just the most high-level dependencies mentioned. This has led to issues in the past:

I suspect this will be a bigger issue as time goes by and new version of implicit dependencies become available. So specifying the exact dependency is a good idea to work around this issue.

@ManavalanG
Copy link
Member Author

All dependencies can be identified from the existing conda environment. Here I used conda envs created by snakemake (for quac) with this script:

#!/usr/bin/env bash
set -euo pipefail

ml reset
ml Anaconda3

OUT_DIR="data/test"
mkdir -p $OUT_DIR
SNAKEMAKE_CONDA_DIRPATH="/path/to/quac/1.0/.snakemake/conda"

for conda_env in $(ls -d ${SNAKEMAKE_CONDA_DIRPATH}/*/)
do
    echo $conda_env
    env_dirpath=$(dirname $conda_env)
    env_name=$(basename $conda_env)
    echo $env_name
    
    cp ${env_dirpath}/${env_name}.yaml ${OUT_DIR}/${env_name}.yaml

    set +eu     # see https://github.com/conda/conda/issues/8186#issuecomment-532874667
    conda activate ${env_dirpath}/${env_name}
    set -eu     # https://github.com/conda/conda/issues/8186#issuecomment-532874667
    conda env export > ${OUT_DIR}/${env_name}_exported.yaml
    sleep 5
done

@ManavalanG
Copy link
Member Author

mentioned in commit 6ddf6d9b85f6a289c1bbd94bed5bf1d564393755

@ManavalanG
Copy link
Member Author

mentioned in commit 544a7f6df319c386f4deaa8a145c6e9f5fe5f3f8

@ManavalanG
Copy link
Member Author

mentioned in commit 92db1d1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant