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

oggm yaml file destroys other conda environments #1571

Closed
marvande opened this issue Apr 20, 2023 · 6 comments
Closed

oggm yaml file destroys other conda environments #1571

marvande opened this issue Apr 20, 2023 · 6 comments

Comments

@marvande
Copy link

Hi, it happened twice to us (once locally and once on a cloud machine) that your yaml file from here destroyed all of our other conda environments when using it to create the oggm environment. That's very unfortunate, and it would be great if you looked into it so that it does not happen to other people. Thanks!

@fmaussion
Copy link
Member

Hi @marvande , I'm sorry this happened to you.

It is very very unlikely that this has anything to do with us. This is a classic conda file, it should create a new conda environment with the name specified at line 1, and if conda allows a yaml file to delete all other environments there is something very wrong in conda or one of the packages in this list. I am using this file regularly without any issues (in fact, I just tested it by changing line 1 to oggm_env_destroy and all my envs are still there).

(base) mowglie@flappi-top:~$ conda info --envs
# conda environments:
#
base                  *  /home/mowglie/.miniconda3
climvis                  /home/mowglie/.miniconda3/envs/climvis
oggm_env_destroy         /home/mowglie/.miniconda3/envs/oggm_env_destroy
oggm_env_unpinned        /home/mowglie/.miniconda3/envs/oggm_env_unpinned
oggm_pymc                /home/mowglie/.miniconda3/envs/oggm_pymc
py3                      /home/mowglie/.miniconda3/envs/py3
py3-latest               /home/mowglie/.miniconda3/envs/py3-latest

A few questions to maybe find out what is going on:

  • what OS are you using?
  • are you using conda or mamba?
  • is your conda / mamba install up to date?
  • how did you install mamba / conda?
  • did you run mamba env create -f environment.yml from the base environment?

@marvande
Copy link
Author

Hi thanks for your quick answer :) we checked with Facu, and the environments were not fully deleted but apparently, the path to them was lost. As you can see below when I call conda activate, my old py38 (on the bottom) still exists but conda can't find it anymore when listing the environments.

-:~$ conda env list
# conda environments:
#
base                     /home/user/mambaforge
oggm_env                 /home/user/mambaforge/envs/oggm_env
                         /home/user/scratch/anaconda3
                         /home/user/scratch/anaconda3/envs/py38

We also noticed there's no conda_rc file.
And to answer your question, on the cloud it was run on cryocloud (in the glaciology ML workshop) and locally it's on a linux server. I ran the create environment from base with mamba (both mamba and conda are up to date).

@fmaussion
Copy link
Member

I really can't believe this has anything to do with OGGM.

what is unusual in your install is that the envs are at different locations /home/user/mambaforge and /home/user/scratch. While I assume this must be something that conda allows to do with some configuration file, it is not something I know how to deal with.

Intuitively, I would think that the command mamba env create -f environment.yml is what you would need to adapt to install environments elsewhere than in the default conda folder (/home/user/mambaforge). But I'm not a conda expert.

@marvande
Copy link
Author

Yes I'm not really an expert either so I don't know. But I know that on the cloud it was installed using conda and not mamba so it can't be a mamba problem. Anyway thanks for checking it out :)

@ehultee
Copy link
Member

ehultee commented Apr 20, 2023

This is possible when you switch from using conda (as you might have for most environments) to using mamba (as the OGGM install instructions recommend). It is not to do with OGGM, but with the setup of conda and mamba.

There is a one-line fix in the terminal to tell conda where to look for environments:
conda config --append envs_dirs /home/user/scratch

If needed. you could reset the default path (and keep other location discoverable) with
conda config --prepend envs_dirs /home/user/mambaforge/envs
for example.

@fmaussion
Copy link
Member

Closing this as this is a conda / mamba issue. We will add something to the docs about it.

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

3 participants