-
Notifications
You must be signed in to change notification settings - Fork 427
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
Allow to specify channels in a recipe #532
Comments
The problem with this is that the channels would only be added at build time, so it's only useful if you need them for your build dependencies. For the run dependencies, your users will still need to add those channels manually. |
+1 |
@asmeurer |
I finally found a way to get around this situation. When I build my package I use the following command : And when I install my package in a virtual environment : It's far from being clean... But it works. |
@yohannLelievre |
@alstuder When I executed the command below: When I executed this command: And when I finally executed this command: So maybe your issue is coming from your conda or conda-build version? |
Any news on this issue? It would be really nice to be able to specify the channels in the I understand it might be complicated to implement, but it would definitely be a nice feature. And a side note: I think this issue actually goes deeper since there are many channels on Anaconda Cloud that provide the same version of the same package, but they are not really equivalent because sometimes people don't package the software properly or not in its entirety for whatever reason. So it can happen that a package might not work due to rather cryptic reasons because it is linked against an incomplete package during runtime, for example. |
Is there any solution to it now? Could be a nice feature. |
Here to jump on the bandwagon and state that it might be a nice feature. On the other hand, it might introduce unnecessary restrictions, e.g. a conda build recipe says it requires XYZ package from channel ABC, but in actuality the XYZ package from channel DEF would work just as well to satisfy that dependency. Yet again, packages from different channels which should work well together often don't actually work as well together as would be expected (e.g. unexpected clashes between packages in the standard Anaconda channel and packages in Conda-Forge). At the very least, it might be helpful to be able to indicate in a recipe somehow that a dependency is required which isn't found (at the time of the creation of the recipe) in the standard channel. But that might not necessarily be the same thing as the proposed feature. |
Conda now supports channel as part of a package spec. This is in theory possible to support in conda-build. Unfortunately, the team at anaconda is overbooked with other work, and as this feature does not directly benefit anaconda (the company), it is especially low priority for us. This feature will not happen without a community contribution. |
We are interested in this feature. E.g. we might want to build using tools from |
I really need this feature. |
Just to provide an example of what this would look like with the package spec syntax @msarahan mentioned... # meta.yaml
package:
name: test_recipe_needing_channel
version: 1.0
requirements:
build:
- python
# this is only available at conda_build_test, and is a test of whether that channel is available.
- conda-forge::conda_build_test_requirement Modified this test and reused it for this example. |
@msarahan, completely understand this. Would you be able to provide the steps needed and some guidance about where to look for relevant pieces? I think we will need some of this knowledge transfer for a community contributor to get started 🙂 |
This is a rabbit hole. Adding it for one spec is obvious, and probably easy. However, where should dependencies of that come from? If they're only available on the specified channel, that's fine, but what if they're available on both the specified channel and the global channels? What is the priority? How do you treat that priority separately from other packages that should follow the global priority order? I don't think that can be defined in an always-right way. The places you have to add this are wherever conda-build is parsing the meta.yaml into MatchSpecs. Here is a good place to start: https://github.com/conda/conda-build/blob/master/conda_build/metadata.py#L1203 |
Is it any less of a rabbit hole than doing something like this?
Ok so is it just an issue of parsing? Or is there an additional step of passing this on to Conda to solve? |
7 years later... no solution yet? |
Bringing this up again, as also discussed in #548, it's still a nightmare to add packages where a dependency is not on conda, namely: A user cannot simply install package A from the usual (say, conda-forge) channel but also needs to add channel Beta because of dependency B. He may only wants to have this channel there for the install, so he looks it up and adds it manually. Factually, a user will look at the package description. Which says "add channel B". He will do that. Without looking at it. And so on. If you install a package, you trust it. And then you also trust that it specifies good dependencies. So why not add it in the recipe? In fact, this is how pip works the whole time! Anyone can upload a package, and if you install it, it will simply pull in the dependencies, regardless whether it was published by someone specific. For users, which channel actually provides dependency B, is an implementation detail. Why would someone care? Maybe just to figure out:
|
To answer that, I think they should be handled exactly like
No new magic or logic, simply moving this step, which needs to be done manually by the user, into the file created by the package manager. That's all. |
annoyingly my receipe fails in the staged receipes pipeline because we still cannot set channels for packages |
micromamba info
Perhaps, if the recipe used that syntax it could also be made to work? |
The bits are there, and can be implemented, but I've seen some quirks (e.g. I think That said, I think we should only allow channels that are already in the global list of channel sources in |
Yeah Good point. If we do that, then it is probably worth adding a good error message like "the package X is requesting package Y from channel C, which is not in the channel sources. Please add channel C to the channels if this is acceptable/intended" |
Could someone please clarify what the state of this is? Update: I did some testing, and think it is honored, but callers still have to enable the channel when installing the package (seems like that's what this issue is about). Note, if not enabling the channels, the install command takes very long and in the end yields a non-descriptive error that requirements could not be satisfied. |
8 years later, is this issue solved? |
It is now 2024 and I fear that this has still not been resolved. I am able to build my package when I specify the channel name using conda-forge::mat73 in meta.yaml. But when installing the package after building, it states that the requirements could not be resolved. It gives me the following error: The following package could not be installed Maybe there is a way to make this work, at least for conda-forge dependencies? |
Actually, the new We didn't want to add it to the recipe itself because then it becomes less portable (although one could argue that we could make it easy to override the channels as well). For example, users might want to rebuild the package on their own channel. What we are working towards is being able to export channel dependencies (eg. being able to say "bioconda" depends on "conda-forge") as part of the channel metadata. I am curious how folks think this feature should work. |
constructor has a |
Thank you both for your responses and helpful insights! From my understanding, the ideal solution would be for the channels that a package depends on (like conda-forge for mat73) to be exported as part of the package metadata. This way, during installation, Conda would automatically know which channels are required and could resolve the dependencies correctly without needing users to manually specify channels. However, for this to work seamlessly, it seems like Conda itself would also need to implement support for handling and using this channel metadata. I’m glad to hear that Rattler-Build is moving in this direction, and I hope that Conda will also implement this functionality in the future. For now, I’ll continue using the workaround of specifying the channels directly in meta.yaml (e.g., conda-forge::mat73), but I’m looking forward to a more seamless solution once channel metadata can be properly exported and supported by Conda. |
like
Not to be confused with specifying channels on a package, which is conda/conda#988.
The text was updated successfully, but these errors were encountered: