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

.conda and .condarc #14

Open
DhruvaSambrani opened this issue May 14, 2022 · 6 comments
Open

.conda and .condarc #14

DhruvaSambrani opened this issue May 14, 2022 · 6 comments
Labels
help wanted program addition Add configuration for a program

Comments

@DhruvaSambrani
Copy link

I do not know the norm

@b3nj5m1n
Copy link
Owner

Hi! I don't use this myself, so I didn't have the chance to try it out when I went through the arch wiki article.

According to that, the following files exist:

  • ~/.conda/.condarc
  • ~/.conda/condarc
  • ~/.conda/condarc.d/
  • ~/.condarc

And the suggested solution is the following export:

export CONDARC="$XDG_CONFIG_HOME/conda/condarc"

It's unclear to me if this will move just the rc file, or the directory as well, and what role the rc files in the directory play.

If you could give me some insight, that would be great!

@mxmlnkn
Copy link
Contributor

mxmlnkn commented Mar 28, 2023

For testing, you can install miniconda.

The ~/.condarc file is created by conda config. E.g., try:

> conda config --show-source
==> /home/user/.condarc <==
anaconda_upload: False

> mkdir $XDG_CONFIG_HOME/conda
> cp ~/.condarc "$XDG_CONFIG_HOME/conda/condarc"
> CONDARC="$XDG_CONFIG_HOME/conda/condarc" conda config --show-source
==> /home/user/.config/conda/condarc <==
anaconda_upload: False

==> /home/user/.condarc <==
anaconda_upload: False

> cp ~/.condarc ~/.conda/condarc
> CONDARC="$XDG_CONFIG_HOME/conda/condarc" conda config --show-source
==> /home/user/.config/conda/condarc <==
anaconda_upload: False

==> /home/user/.conda/condarc <==
anaconda_upload: False

==> /home/user/.condarc <==
anaconda_upload: False

It's unclear to me if this will move just the rc file, or the directory as well, and what role the rc files in the directory play.

~/.conda/condarc is only yet another alternative path for condarc.

The linked list of alternative paths suggest to me that CONDARC only affects the condarc file. For the .conda folder, CONDA_ROOT would have to be set. But from the documentation it seems that conda is automatically looking inside $XDG_CONFIG_HOME/conda/ first. Simply moving ~/.conda there and moving ~/.condarc into ~/.conda/condarc should work.

> mv ~/.conda "$XDG_CONFIG_HOME/conda"
> conda config --show-source
==> /home/user/.config/conda/condarc <==
anaconda_upload: False
> conda config --set anaconda_upload true
> conda config --show-source
==> /home/user/.config/conda/condarc <==
anaconda_upload: False

==> /home/user/.condarc <==
anaconda_upload: True

> export CONDARC="$XDG_CONFIG_HOME/conda/condarc"
> export CONDA_ROOT="$XDG_CONFIG_HOME/conda"
> rm ~/.condarc
> conda config --set anaconda_upload true
> conda config --show-source

==> /home/user/.config/conda/condarc <==
anaconda_upload: False

==> /home/user/.condarc <==
anaconda_upload: True

As the above log shows, I am unable to make miniconda use the XDG path when changing settings. Reading from XDG paths does not seem to be a problem but neither CONDARC nor CONDA_ROOT environment variables seem to work for conda config --set. Maybe I'm doing something wrong, maybe it is a bug.

@b3nj5m1n
Copy link
Owner

@mxmlnkn Thank you for the write-up, I don't have the time to properly look into this at the moment, so I'll just add conda as being unsupported and link to this issue. (5e208d2)

If you, or anyone else, finds a way to make conda respect XDG, please create a PR or let me know!

@utkarshgupta137
Copy link

There is already an issue: conda/conda#8804

@e-khurmamatov
Copy link
Contributor

e-khurmamatov commented May 6, 2023

conda and miniconda already support configuration files in the following directories (as described in conda/conda#10982 and conda documentation):

  • '$XDG_CONFIG_HOME/conda/.condarc',
  • '$XDG_CONFIG_HOME/conda/condarc',
  • '$XDG_CONFIG_HOME/conda/condarc.d/',
  • '~/.config/conda/.condarc',
  • '~/.config/conda/condarc',
  • '~/.config/conda/condarc.d/'

The only issue is ~/.conda/environments.txt (as mentioned in conda/conda#8804).

conda.json might be updated accordingly.

TinfoilSubmarine pushed a commit to TinfoilSubmarine/xdg-ninja that referenced this issue Jul 19, 2023
@jrom99
Copy link

jrom99 commented Mar 20, 2024

Hello, to update here, there is another file that is created by conda: aau_token (conda/conda#13453 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted program addition Add configuration for a program
Projects
None yet
Development

No branches or pull requests

6 participants