mamba icon indicating copy to clipboard operation
mamba copied to clipboard

bug: ~/.mambarc do not work

Open yarnabrina opened this issue 2 years ago • 10 comments

I installed the latest version of Mambaforge and set up a configuration file identical to my stable .condarc file. While creating a new environment or anything else for that matter, this file is not respected at all, even though this should have been according to this.

Reproducible setup

Used configuration file

channels: ### the list of conda channels to include for relevant operations
  - defaults
  - conda-forge

channel_priority: strict ### with strict channel priority, packages in lower priority channels are not considered if a package with the same name appears in a higher priority channel

create_default_packages: ### packages that are by default added to a newly created environments
  - python>=3.7

always_yes: false ### automatically choose the 'yes' option whenever asked to proceed with a conda operation

auto_activate_base: false ### automatically activate the base environment during shell initialization

add_pip_as_python_dependency: true ## add pip, wheel, and setuptools as dependencies of Python

Used command

mamba create --name test

This should try to create a new environment with python version >= 3.7. And that did not happen, and an environment got created with no package and without python itself.

Workaround

Just renaming the file from ~/.mambarc to ~/.condarc solves the issue.

yarnabrina avatar Oct 08 '22 18:10 yarnabrina

I was trying micromamba in a test docker container in WSL, and envs_dirs do not seem to work, and renaming file does not solve the issue.

Reproducible Example:

Steps

  1. New docker container of latest Ubuntu LTS
docker run --rm -it ubuntu:22.04
  1. Install dependencies
apt-get update && apt-get install -y --no-install-recommends bzip2 ca-certificates curl vim
  1. Install micromamba
curl micro.mamba.pm/install.sh | bash
  1. Load bash with mamba initialised
source ~/.bashrc
  1. Create mamba configurations file at ~/.mambarc
envs_dirs:
  - ${HOME}/my-mamba-env-dir
show_banner: false
  1. Create a new environment
micromamba create -n test

What happens

It creates the test environment at /root/micromamba/envs/test.

What is expected

It should create the test environment at /root/my-mamba-env-dir/test

Extra Information

As far as I can see, the configuration is detected correctly:

root@8a4e815863ed:/# micromamba config list
envs_dirs:
  - /root/my-mamba-env-dir
show_banner: false
root@8a4e815863ed:/# micromamba config describe
# envs_dirs
#   Possible locations of named environments

# show_banner
#   Show the banner

Renaming the file to ~/.condarc has no effect.

Micromamba version

root@8a4e815863ed:/# micromamba info

            environment : None (not found)
           env location : -
      user config files : /root/.mambarc
 populated config files : /root/.mambarc
       libmamba version : 0.27.0
     micromamba version : 0.27.0
           curl version : libcurl/7.85.0 OpenSSL/1.1.1q zlib/1.2.12 libssh2/1.10.0 nghttp2/1.47.0
     libarchive version : libarchive 3.3.3 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 liblz4/1.9.2 libzstd/1.4.5
       virtual packages : __unix=0=0
                          __linux=5.15.68=0
                          __glibc=2.35=0
                          __archspec=1=x86_64
               channels :
       base environment : /root/micromamba
               platform : linux-64

Given this, it seems to be a hug instead of a documentation issue. @jonashaag, let me know if any more information will help you in finding the cause of this.

yarnabrina avatar Oct 25 '22 14:10 yarnabrina

Could it be that envs_dirs is ignored by micromamba? If I try with channels in ~/.mambarc it seems to work

jonashaag avatar Oct 25 '22 15:10 jonashaag

@jonashaag, That happens for me as well. But since it gets listed in micromamba config as shown above, I think it's not ignored altogether.

Please take a look at this:

root@60594ff0203c:/# cat ~/.mambarc
channels:
  - conda-forge
  - defaults
envs_dirs:
  - ${HOME}/my-mamba-env-dir
create_default_packages:
  - pip
  - setuptools
  - wheel
show_banner: false
root@60594ff0203c:/# micromamba config list
envs_dirs:
  - /root/my-mamba-env-dir
channels:
  - conda-forge
  - defaults
show_banner: false
root@60594ff0203c:/# micromamba config describe
# envs_dirs
#   Possible locations of named environments

# channels
#   Define the list of channels

# show_banner
#   Show the banner

I interpret this as everything in my ~/.mambarc except create_default_packages is supported by micromamba. I've found this leading me to think it should not be ignored, but I'm afraid I can't say anything more with certainty.

https://github.com/mamba-org/mamba/blob/3a5cd599d68bdcd74d9e64e82c221dcd2f6fdafd/libmamba/src/api/configuration.cpp#L1019-L1026

FYI: I've had doubts regarding difference between conda and mamba configurations myself, and hence created #1997 earlier.

yarnabrina avatar Oct 25 '22 15:10 yarnabrina

So I guess the option is ignored in micromamba create?

jonashaag avatar Oct 25 '22 16:10 jonashaag

It appears that way, which kind of stops us in using it in our environments.

Ref. https://github.com/mamba-org/mamba/issues/1110#issuecomment-945415037

yarnabrina avatar Oct 26 '22 06:10 yarnabrina

Ok, let’s continue discussion there.

jonashaag avatar Oct 26 '22 06:10 jonashaag

The initial issue of ~/.mambarc not working with Mambaforge and ~/.condarc working is still true. So, not sure if this ought to be closed.

yarnabrina avatar Oct 27 '22 08:10 yarnabrina

Can you please show a concrete example how to reproduce this? Edit: Ah sorry, it's in the initial post.

jonashaag avatar Oct 27 '22 08:10 jonashaag

Does this only apply to the create_default_packages option?

jonashaag avatar Oct 27 '22 08:10 jonashaag

Based on my limited tests, I think ~/.mambarc is completely ignored by Mambaforge. For example, I added auto_activate_base: false in ~/.mambarc and ensured that there is no ~/.condarc, and resourcing ~/.bashrc activated the base environment. And then just copying it to ~/.condarc does what I expect.

The following shows that even though both files are present, ~/.mambarc is ignored altogether.

image

I hope it's not system specific, but I've running Mambaforge in a Ubuntu 22.04 container through Docker Desktop on Windows 11 Home.

P.S. Just FYI, Mambaforge + ~/.condarc respects envs_dirs, while micromamba + ~/.mambarc does not.

yarnabrina avatar Oct 27 '22 10:10 yarnabrina

For example, I added auto_activate_base: false in ~/.mambarc and ensured that there is no ~/.condarc, and resourcing ~/.bashrc activated the base environment.

Depending on how your shell is set up, environment activation is actually done by Conda, not Mamba. Can you try this with another option that's not shell activation related?

jonashaag avatar Nov 07 '22 18:11 jonashaag

I just tried with channels and indeed the file seems to be ignored entirely.

jonashaag avatar Nov 07 '22 18:11 jonashaag

It works with Micromamba so I think it's a bug.

jonashaag avatar Nov 07 '22 18:11 jonashaag

Hi,

From what I can see, it's the other way around -

~/.mambarc ignored by Micromamba, but not Mamba

.. or it's related to https://github.com/mamba-org/mamba/issues/1110 as mentioned above

Here is a reproduction ( on linux )

>$ micromamba --version  
1.2.0

>$ micromamba config list
envs_dirs:
  - /home/me/harelw/.conda/envs
pkgs_dirs:
  - /home/me/harelw/.conda/pkgs
channels:
  - conda-forge
  - pytorch
default_channels:
  - conda-forge
ssl_verify: /etc/ssl/certs/ca-certificates.crt
safety_checks: disabled
auto_activate_base: true
changeps1: true
show_banner: false

>$ micromamba create -n luli -y

Empty environment created at prefix: /home/mobileye/harelw/micromamba/envs/luli

This is usage blocker also for me.

Thanks, Harel

harelwa avatar Feb 03 '23 15:02 harelwa