conda / conda

A system-level, binary package and environment manager running on all major operating systems and platforms.
https://docs.conda.io/projects/conda/
Other
6.46k stars 1.68k forks source link

Add way to dynamically ignoring .condarc at runtime #14345

Open cohml opened 2 weeks ago

cohml commented 2 weeks ago

Checklist

What is the idea?

Implement a flag like --ignore-condarc which, if passed, ignores all configurations enumerated in .condarc, instead falling back to whatever conda's default configuration is.

For example, if ~/.condarc enumerates certain default channels, conda env create --file environment.yaml --ignore-condarc would bypass that channel.

I'm not a conda expert though, so this proposal may only make sense for commands like create, rather than a more globally relevant flag.

Why is this needed?

Given an arbitrary conda command, its behavior can differ for different users depending on the contents of each user's .condarc file. This can cause .condarc to actually "get in the way". So it would be nice to have some way to ignore .condarc, causing said command to fall back on conda's default configuration, ensuring it will run identically across any environment. This flag would also be a nice quick way to isolate when .condarc is the source of a problem, rather than having to manually remove/rename the file while testing.

What should happen?

Conda should fall back on its default settings, equivalent to if no .condarc file existed. Temporarily though, only for the duration that the command with --ignore-condarc is being executed.

Additional Context

No response

travishathaway commented 2 weeks ago

@cohml,

Just curious, does the --override-channels option at least get you part of the way there? It's purpose is to ignore any channels configured in the .condarc and will force you to specify this manually.

Beyond that, adding an option like this would actually directly conflict with how we advise users to set up multi-user installations. These installations rely on the fact that conda will in all circumstances read from specific .condarc files defined on the system. Giving users the ability to turn this off completely would in theory allow them to bypass rules setup by their administrators.

This multi-user configuration system does have problems though and can already be by-passed as I have detailed here:

But still, I believe that we shouldn't give users the ability to explicitly bypass it.

Happy to discuss this feature request further though if you or anyone else feels differently.

cohml commented 1 week ago

Yes and no...

The problem with --override-channels is that it is only available for conda create. conda env create, which seems like a pretty similar command to be frank, does not support it.

So yes, but only for my specific problem and only when using conda create. That's a pretty big asterisk.

Unfortunately I work with yaml files a lot so typically use conda env create over conda create. So --ignore-condarc or equivalent would still strikes me as a potentially valuable addition.