这是indexloc提供的服务,不要输入任何密码
Skip to content

--no-user flag on conda init does not prevent .bashrc update as expected #11948

@xylar

Description

@xylar

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

I ran:

conda init --no-user

on a new mambaforge installation with conda 22.9.0.

I expected this would alter the shebangs in condabin/conda, bin/conda, and /bin/conda-env without altering by .bashrc but even with this flag, my .bashrc was still modified.

Conda Info

active environment : base
    active env location : /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge
            shell level : 1
       user config file : /home/ac.xylar/.condarc
 populated config files : /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge/.condarc
                          /home/ac.xylar/.condarc
          conda version : 22.9.0
    conda-build version : 3.22.0
         python version : 3.10.6.final.0
       virtual packages : __linux=4.18.0=0
                          __glibc=2.28=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge  (writable)
      conda av data dir : /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge/pkgs
                          /home/ac.xylar/.conda/pkgs
       envs directories : /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge/envs
                          /home/ac.xylar/.conda/envs
               platform : linux-64
             user-agent : conda/22.9.0 requests/2.28.1 CPython/3.10.6 Linux/4.18.0-348.23.1.el8_5.x86_64 rhel/8.5 glibc/2.28
                UID:GID : 7940:20001
             netrc file : None

Conda Config

==> /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge/.condarc <==
channels:
  - conda-forge

==> /home/ac.xylar/.condarc <==
channel_priority: strict
channels:
  - conda-forge
  - defaults

Conda list

# packages in environment at /gpfs/fs1/home/ac.xylar/chrysalis/mambaforge:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
anyio                     3.6.1              pyhd8ed1ab_1    conda-forge
attrs                     22.1.0             pyh71513ae_1    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.11.1             pyha770c72_0    conda-forge
boa                       0.12.0             pyha770c72_4    conda-forge
brotlipy                  0.7.0           py310h5764c6d_1004    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.9.24            ha878542_0    conda-forge
certifi                   2022.9.24          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_0    conda-forge
chardet                   5.0.0           py310hff52083_0    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
colorama                  0.4.5              pyhd8ed1ab_0    conda-forge
commonmark                0.9.1                      py_0    conda-forge
conda                     22.9.0          py310hff52083_1    conda-forge
conda-build               3.22.0          py310hff52083_2    conda-forge
conda-package-handling    1.9.0           py310h5764c6d_0    conda-forge
cryptography              38.0.1          py310h597c629_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
filelock                  3.8.0              pyhd8ed1ab_0    conda-forge
future                    0.18.2          py310hff52083_5    conda-forge
glob2                     0.7                        py_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.4          py310hff52083_0    conda-forge
importlib_resources       5.10.0             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.2.0              pyhd8ed1ab_0    conda-forge
json5                     0.9.5              pyh9f0ad1d_0    conda-forge
jsonschema                4.16.0             pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.19.3               h3790be6_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libarchive                3.5.2                hb890918_3    conda-forge
libcurl                   7.85.0               h7bff187_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
liblief                   0.12.2               h27087fc_0    conda-forge
libmamba                  0.27.0               h0dd8ff0_0    conda-forge
libmambapy                0.27.0          py310hab0e683_0    conda-forge
libnghttp2                1.47.0               hdcd2b5c_1    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libsolv                   0.7.22               h6239696_0    conda-forge
libsqlite                 3.39.4               h753d276_0    conda-forge
libssh2                   1.10.0               haa6b8db_3    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libxml2                   2.10.2               h4c7fe37_1    conda-forge
libzlib                   1.2.12               h166bdaf_4    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
mamba                     0.27.0          py310hf87f941_0    conda-forge
markupsafe                2.1.1           py310h5764c6d_1    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
openssl                   1.1.1q               h166bdaf_0    conda-forge
patch                     2.7.6             h7f98852_1002    conda-forge
patchelf                  0.15.0               h58526e2_0    conda-forge
pip                       22.2.2             pyhd8ed1ab_0    conda-forge
pkginfo                   1.8.3              pyhd8ed1ab_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.31             pyha770c72_0    conda-forge
prompt_toolkit            3.0.31               hd8ed1ab_0    conda-forge
psutil                    5.9.2           py310h5764c6d_0    conda-forge
py-lief                   0.12.2          py310hd8f1fbe_0    conda-forge
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.3           py310h5764c6d_1010    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.13.0             pyhd8ed1ab_0    conda-forge
pyopenssl                 22.1.0             pyhd8ed1ab_0    conda-forge
pyrsistent                0.18.1          py310h5764c6d_1    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.10.6          h582c2e5_0_cpython    conda-forge
python-libarchive-c       4.0             py310hff52083_1    conda-forge
python_abi                3.10                    2_cp310    conda-forge
pytz                      2022.4             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py310h5764c6d_4    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
reproc                    14.2.3               h7f98852_0    conda-forge
reproc-cpp                14.2.3               h9c3ff4c_0    conda-forge
requests                  2.28.1             pyhd8ed1ab_1    conda-forge
rich                      12.6.0             pyhd8ed1ab_0    conda-forge
ripgrep                   13.0.0               h2f28480_2    conda-forge
ruamel.yaml               0.17.21         py310h5764c6d_1    conda-forge
ruamel.yaml.clib          0.2.6           py310h5764c6d_1    conda-forge
ruamel_yaml               0.15.80         py310h5764c6d_1007    conda-forge
setuptools                65.4.1             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.64.1             pyhd8ed1ab_0    conda-forge
typing_extensions         4.4.0              pyha770c72_0    conda-forge
tzdata                    2022d                h191b570_0    conda-forge
urllib3                   1.26.11            pyhd8ed1ab_0    conda-forge
watchgod                  0.8.2              pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
yaml-cpp                  0.7.0                h27087fc_2    conda-forge
zipp                      3.9.0              pyhd8ed1ab_0    conda-forge
zstd                      1.5.2                h6239696_4    conda-forge

Additional Context

I am attempting to use conda init to fix the issue described in #11885 using the solution in #11885 (comment), but I do not wish to alter my .bashrc because I want to activate the conda environment manually instead.

I believe the issue is with:
https://github.com/conda/conda/blob/22.9.0/conda/cli/conda_argparse.py#L706-L707

If I manually alter this to be:

        action="store_true",

I get the expected behavior.

The help text is also not correct and should be:

        help="Don't initialize conda for the current user.",

i.e., this is not the default behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogissue has been triaged but has not been earmarked for any upcoming releaselocked[bot] locked due to inactivitytype::bugdescribes erroneous operation, use severity::* to classify the type

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions