JuliaPy / PythonCall.jl

Python and Julia in harmony.
https://juliapy.github.io/PythonCall.jl/stable/
MIT License
776 stars 63 forks source link

How to use package if conda-forge must be accessed through a proxy channel? #475

Closed DrChainsaw closed 6 months ago

DrChainsaw commented 6 months ago

Not sure what the right terminology here is, but the problem setup is like this:

I have an environment where access to conda-forge must happen through some jfrog artifactory. This is supposed to work by using channel_alias in the .condarc file.

The problem however is that the channel name itself is also changed to something like conda-forge-proxy. For example, packages normally available in https://conda.anaconda.org/conda-forge are available in https://artifactory.url/conda-forge-proxy.

From what I can tell there is no way to make the translation "conda-forge" => "conda-forge-proxy" in the .condarc as micromamba always adds whatever is after the -c at the end of the URL, resulting in micromamba trying to access either https://artifactory.url/conda-forge-proxy/conda-forge or https://artifactory.url/conda-forge, neither of which is valid.

Is there anyway to change the channels of a dependencies?

From reading the source code of CondaPkg, it seems that conda-forge is hardcoded as the default channel there. Would it be better to just leave it empty and use whatever defaults the user might have in their .condarc?

Fwiw, I'm not very experienced with neither conda nor artifactory so there might be aspects of it I don't know, but the lack of possibility to remap channel names in conda in combination with artifactory allowing this seems a bit baffling to me.

cjdoris commented 6 months ago

I'm also not an expert in this aspect of Conda.

From what I can tell, the only problem is with the channel name (conda-forge-proxy instead of conda-forge) and you have the base proxy URL working ok via Conda settings?

From reading about Conda config it doesn't look like there is a setting to rename channels. I'd be happy to add such a setting to CondaPkg - or better still you could make a PR for this feature.

DrChainsaw commented 6 months ago

Great!

I will first try to ask around to see if I can find someone who can tell me if there is some idiomatic solution to this problem within conda. Maybe it for example just is our artifcatory that is misconfigured.

After that I'll look into a PR. I suppose one could add the remapping to the CondaPkg.toml file, but it should probably be some system global config instead since it depends more on the environment where the package is installed to than the package itself. Are there better options than environment variables for this?

cjdoris commented 6 months ago

User preferences in CondaPkg are set using env vars or Julia preferences (https://github.com/JuliaPy/CondaPkg.jl/?tab=readme-ov-file#preferences).

But yeah, ideally you'd just have artifactory set up to use the correct channel names.

DrChainsaw commented 6 months ago

I managed to get an admin to sit and cross check logs with me and they did something on their side (don't know what exactly) that made it work for me.

Sorry for the noise. Didn't really know where to start with this problem.