franciscozorrilla / metaGEM

:gem: An easy-to-use workflow for generating context specific genome-scale metabolic models and predicting metabolic interactions within microbial communities directly from metagenomic data
https://franciscozorrilla.github.io/metaGEM/
MIT License
203 stars 42 forks source link

error while running env_setup.sh script: #43

Closed slambrechts closed 3 years ago

slambrechts commented 3 years ago

Hi,

I'm getting the following error while running the env_setup.sh script:

CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'.

I tried conda init bash and source /home/slambrecht/miniconda2/etc/profile.d/conda.sh to solve it, but to no avail.

Also, when I try to run conda deactivate manually, I experience no problems

full output:

Checking if conda is available ... detected version 4.7.12!
Checking if mamba environment is available ... env_setup.sh: line 33: mamba: command not found
Do you wish to create an environment for mamba installation? This is recommended for faster setup (y/n)y

CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

Do you wish to download and set up metaGEM conda environment? (y/n)^C
slambrechts commented 3 years ago

I tried to solve it by adding

export -f conda
export -f __conda_activate
export -f __conda_reactivate
export -f __conda_hashr

to my bashrc file

This allowed conda to continue and install mamba. However, when the script enters the next step and tries to download and set up the metaGEM conda environment, I get:

bash: line 1: mamba: command not found

franciscozorrilla commented 3 years ago

Hi Sam,

Thanks for reporting the bug, I have not encountered this problem before. Are you setting up metaGEM on the cluster or on your local machine?

From what you are telling me it sounds like the script is having trouble finding your mamba installation. Can you verify that there is indeed a mamba conda env installed on your system by running conda --info envs? If there is an environment called mamba, can you then run source activate mamba && mamba --version? If mamba is properly installed you should get an output like:

mamba 0.10.0
conda 4.10.1
slambrechts commented 3 years ago

Hi Francisco,

Thank you for your reply. I'm trying to set up metaGEM on a local machine with 40 threads and 500 GB RAM.

There is indeed a mamba conda env now, and when I run source activate mamba && mamba --version I get:

mamba 0.13.0
conda 4.10.1

I don't think it is the first time conda gets called from a bash script, I think that has happened before when installing MG-atlas, so I'm not sure what is causing this. Maybe I should try the manual setup?

franciscozorrilla commented 3 years ago

Hey Sam,

I am curious, what happens if you activate the mamba env and then run bash env_setup.sh?

In any case, if you want to skip the script and set up manually then could you please try activating the mamba env, moving into your metaGEM folder, and running:

mamba env create --quiet --prefix ./envs/metagem -f envs/metaGEM_env.yml

This should set up a conda environment and install most of the core packages.

Also, just in case you haven't already seen it, I recommend you check out the google colab notebook. In section 2) you can see how to finish manually setting up metaGEM.

Please let me know if you have any further issues with the env_setup.sh script or with manual setup.

Best wishes, Francisco

slambrechts commented 3 years ago

Hi Francisco,

Ok, I did not yet see the google colab notebook. Very usefull, thanks! In the meantime I started following the Manual setup, but by doing so, I now realize the metagem, metawrap and prokkaroary environments are located in:

/home/slambrecht/miniconda2/envs/

and not in metaGEM/envs/

I assume I can not just copy the env directories to metaGEM/envs/. Would it be best to remove them, and start anew, following the advice you gave me above?

Kind regards, Sam

franciscozorrilla commented 3 years ago

Hey Sam,

If you are confident that those envs are functional and properly installed, then you can modify your config.yaml file like so:

  1. Open your config.yaml file and go to the envs section at the bottom: https://github.com/franciscozorrilla/metaGEM/blob/98facf2d831a944ceb22554b5c9672eba393ffb8/config.yaml#L79-L82

  2. Append path prefix to the envs, in your case:

    envs:
    metagem: /home/slambrecht/miniconda2/envs/metagem
    metawrap: /home/slambrecht/miniconda2/envs/metawrap
    prokkaroary: /home/slambrecht/miniconda2/envs/prokkaroary

    Now snakemake should be able to identify and activate envs within jobs.

If you think your envs may have been corrupted/incompletely installed then you can simply remove them and re-install them up in your envs folder.

conda env remove -n ENV_NAME

Let me know if this works out for you.

Best, Francisco

slambrechts commented 3 years ago

Hi Francisco,

Great, thank you! Regarding CPLEX, you write

install this dependency manually within the metagem conda environment.

Does that mean I have to specify /home/slambrecht/miniconda2/envs/metagem/bin, when InstallAnywhere prompt asks me where I would like to install CPLEX Optimization Studio 20.1.0.?

Or how should I install CPLEX manually within the metagem conda environment?

franciscozorrilla commented 3 years ago

Hi Sam,

Thanks for pointing that out, I should clarify: I mean activate the metagem env and then run the installer. I believe you can install CPLEX anywhere, but it does not hurt to put it in that path. Let me know if you have trouble setting up CPLEX.