Setup Custom Conda Configuration for Air-Gapped Environment
In some situations, you might want to override the default locations used by Conda and Pip to look for Python packages. For example, in an air gapped cluster, these default locations will be inaccessible, and you will need to configure conda to download packages from a local or internal repository.
Typical python developers would update configuration using a .condarc file. We expose some of those Conda configuration attributes in C3 Agentic AI Platform through the CondaLibraryManager.Config Type.
Conda configuration in C3 AI
var config = CondaLibraryManager.inst().config();
// Here we set the channelAlias, which prepends the channelAlias URL to non-URL user specified repositories.
config.setConfigValue("channelAlias", "https://your.repo/");
// The defaultChannels attribute determines which channels to search when the user specifies defaults as a repository.
config.setConfigValue("defaultChannels", Array.ofStr("main", "defaultChannel"));
// You may wish to override the channelAlias configured above for specific channel names.
config.setConfigValue("customChannels", Map.ofStrToStr("myCustomChannel", "https://your.custom.repo/"))
// The above configuration deals with where the system will look for conda packages. For packages installed with pip, you
// configure the `baseUrlPPI` attribute.
config.setConfigValue("baseUrlPPI", "https://your.pypi.repo/")User example
Now consider a Python developer who upserts an ImplLanguage.Runtime with the above configuration.
{
"type": "ImplLanguage.Runtime",
"name": "py-custom_runtime",
"languageVersion": "3.9",
"repositories": ["myCustomChannel", "defaults"],
"libraries": ["conda my_lib=1.2.*", "pip my_other_lib==3.*"]
}We would search for Conda packages in the following places:
"https://your.custom.repo/" since the user specified "myCustomChannel" and that is in the "customChannels" attribute.
"https://your.repo/main" and "https://your.repo/defaultChannel". Since the user specified a non-URL repository, we prepend the channelAlias value "https://your.repo/" to the channel name to form the URL. Since the specific repository name was "defaults", we use the channels specified in "defaultChannels", namely "main" and "defaultChannel".
We would search for pip packages in "https://your.pypi.repo/".