harvardinformatics / snpArcher

Snakemake workflow for highly parallel variant calling designed for ease-of-use in non-model organisms.
MIT License
63 stars 30 forks source link

snakemake doesn't have access to mamba #142

Closed brian-arnold closed 3 months ago

brian-arnold commented 7 months ago

Hello!

Three of us at Princeton have independently run into the same problem that we encounter when trying to run the test on the ecoli data. We each followed the installation/setup instructions. I apologize for not having an error message.

While mamba is installed within the snpArcher conda environment, for reasons I don't understand, snakemake doesn't have access to it for activating/managing the environments it creates. The problem is fixed by creating the snpArcher environment according to the tutorial, and then doing:

conda install -n snparcher -c conda-forge mamba

Just posting this here in case there's a more elegant solution for installation/setup for the documentation. But, the additional conda command above could work for people in the meantime.

tsackton commented 7 months ago

I think the issue is probably that mamba is not on the system path in your system. If you follow the miniforge installation for mamba (https://github.com/conda-forge/miniforge), it should modify your bash_rc to put miniforge in the system path. Otherwise, you could make this modification yourself. That will avoid needing to have a separate version of mamba installed in the snparcher environment.

brian-arnold commented 7 months ago

Hi Tim!

Yes, it must be a PATH issue of some sort.

We've been downloading the miniforge3 bash shell script here for Linux, installing it using bash Miniforge3-Linux-x86_64.sh, which makes conda and mamba available in the base environment by appending initialization stuff to the ~/.bashrc file. Both conda/mamba are also available in the snpArcher environment (made according to docs) when you type 'conda' or 'mamba' on the command line after activating it.

I remade a snpArcher environment from scratch just now. I tried running snpArcher, and am getting the error message i mention above:

CreateCondaEnvironmentException: The 'mamba' command is not available in the shell /usr/bin/bash that will be used by Snakemake. You have to ensure that it is in your PATH, e.g., first activating the conda base environment withconda activate base.The mamba package manager (https://github.com/mamba-org/mamba) is a fast and robust conda replacement. It is the recommended way of using Snakemake's conda integration. It can be installed withconda install -n base -c conda-forge mamba. If you still prefer to use conda, you can enforce that by setting--conda-frontend conda.

This message doesn't immediately make sense to me as both conda and mamba are definitely installed in the base environment and in the snpArcher environment, which I confirmed on the command line. Snakemake just can't find it! Out of curiosity have any of you ever encountered this?

cademirch commented 7 months ago

Strange. I have not encountered this before unfortunately. It does seem like a path issue... could it be snakemake is already installed on the system outside of the conda env? Not sure if that would cause this.

tsackton commented 7 months ago

Huh, that is strange. It might be related to this?