-
Notifications
You must be signed in to change notification settings - Fork 112
Description
Checklist
- I added a descriptive title
- I searched open reports and couldn't find a duplicate
What happened?
conda-lock bundles its own, vendored version of conda. conda calculates the sys_rc_path (i.e., the system-global condarc) based on sys.prefix.1
As a result, conda-lock will not pick up the same global condarc as conda, unless conda-lock happens to be installed in conda's own base environment.
Often, conda-lock is installed in a different environment, such as when installed via pixi global, or via a pre-commit hook (as shown in #237 (comment)). In general, it's better to install a global devtool like conda-lock in its own private isolated environment that tools like pixi global can manage for you, rather than put them in conda's base environment, which can result in corrupted or harder-to-upgrade, more error-prone conda installations.
This discrepancy is especially challenging when the global condarc needs to contain config like channel_alias: https://artifactory.mycompany.com/... and channels: [mycompany-internal-channel] (that ideally should not need to be duplicated in every user's ~/.condarc on every host to work around this -- better to keep these settings that user's should not be able to change in a global config file that is not user-writable). When conda-lock has a different sys.prefix and does not pick up this expected global config, solving fails and it is unable to generate lockfiles.
Can conda-lock add logic to detect when its vendored conda's sys.prefix does not match that of the user's conda (i.e., the one that gets resolved based on the user's PATH), and in this case patch in a corrected sys_rc_path value?