merenlab / anvio

An analysis and visualization platform for 'omics data
http://merenlab.org/software/anvio
GNU General Public License v3.0
426 stars 145 forks source link

add a conda `environment.yml` file #2094

Closed ctb closed 1 year ago

ctb commented 1 year ago

This environment.yml works for me on an M1 Mac w/mambaforge enabled like so:

conda config --env --set subdir osx-64
mamba env create -f environment.yml -n anvio-dev

conda activate anvio-dev
pip install -r requirements.txt

anvi-self-test --suite mini

Thanks @ahenoch for all your advice and recommendations!

bluegenes commented 1 year ago

I think conda config --env --set subdir osx-64 changes the base environment so that all packages installed are osx-64. This may affect other installations?

The following restricts the change to just this environment:

CONDA_SUBDIR=osx-64 mamba env create -f environment.yml -n anvio-dev 
conda activate anvio-dev 
conda config --env --set subdir osx-64

pip install -r requirements.txt

anvi-self-test --suite mini

via: https://conda-forge.org/docs/user/tipsandtricks.html

meren commented 1 year ago

We tried to maintain environment.yaml files in the repository before and it turned into a headache. We can add them back again, but probably it would be better to maintain such recipes in anvio.org repository (where the installation instructions are also kept). I'll keep this PR open and perhaps make use of it in the other repository once we release v8. Thank you for it! :)

ctb commented 1 year ago

sure, no worries - we've just been debugging installs for a while now at STAMPS 2023, and this works for me on an M1 Mac.

We use this github actions script to install our conda environment and run tests on our latest on a nightly basis. That way we know the environment file works at least on one computer!

ctb commented 1 year ago

looks like it works on Linux as well. I think the conda-forge/bioconda orders are important (and set properly in this environment.yml).

meren commented 1 year ago

We also have an action script here .. but I have to admit that our avoidance of using an environment.yaml has been extremely annoying since it required us to change both the action script here and installation.md in another repository all the time :/

I will test your file for old MACs and if it is working, I will try to implement a better way to install stuff using the same environment file across repositories.

ctb commented 1 year ago

cool, let me know if I can help test or review docs or ...! (and absolutely no need to credit me for anything - @ahenoch did most of the work, and I'm just recording the resulting artifact!)

meren commented 1 year ago

HAHA, NICE TRY. YOU DID MAKE PR YOU SHALL GET CREDIT. SEE YOU HERE SOON.

ctb commented 1 year ago

noooooooooooo... 😭

meren commented 1 year ago

@ahenoch / @ctb, is it correct for me to assume that you don't need to set the CONDA_SUBDIR environmental variable for Linux systems? I presume this should work for anything except Apple M*:

mamba env create -f environment.yml

Do either of you have any insights into this?

Thanks,

PS: no rush to respond, it can wait until next week, I just didn't want to forget to ask :)

ctb commented 1 year ago

correct!

meren commented 1 year ago

Just FYI, I changed this section of the installation instructions to simplify everything using the environment file above (which is now here):

https://anvio.org/install/#5-follow-the-active-development-youre-a-wizard-arry

Once we release v8, the new installation page will look much cleaner, and I hope we will get our actions script to use the same file to simplify our lives a bit.

Thank you all!