-
Notifications
You must be signed in to change notification settings - Fork 989
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
[feature request] Explain why a match was not found (conan why
)
#4089
Comments
Excellent idea, I've had the same problem many times. But why not extend conan install/create with your idea, instead to create a new command? |
Good idea, and probably easier to implement (no need to record state). |
Hey, nice idea. I think extending "install" ( --verbose maybe?) would be better. Then you have everything in one step, and you don't have to optionally call "why". If "install" fails, the process must be aborted anyway. |
Lets say you have a dependency graph of 50 packages. You fire one I understand the interest of the idea, not saying it wouldn't be useful, but I see it with a low priority and a non trivial complexity. |
Assigned to @lasote for further feedback about this possible feature. |
Understood - but that is much faster than manually digging out the settings and options to figure out what's wrong. I might want to take a stab at this - do labels mean that there would be interest in merging if I made a PR? |
We would need to define what is a "close/near binary package":
Maybe it is enough to show/suggest a "conan search" command with the settings (and the remote) when Conan raises the error because of a missing configuration? It will show a list of available binary packages. |
If I remember correctly, conan doesn't do a form of "matching", instead it computes the package ID from settings+options+requires and then just tries to find that. I would use the same elements in a matching algorithm that are used to compute the hash.
I disagree. While helping the discoverability of search is great for new users, this doesn't really address the recurring pain I outlined in the starting post. It still requires painful manual searching over each configuration exactly the same way I described (and we, seasoned conan users already know how to search so it's not helping us). Search is precisely what I do there as the first step, but it's not enough. |
That is the problem. The |
On the contrary, that would absolutely help. You are making the assumption that I'd solve the setting mismatch by using a different value, which obviously doesn't make sense in your example. But more often than not, the solution is not to change the setting I use, it's to get that missing build. Such output would help me realize what's missing. In this example: "oh, right! I never ran the build for Linux. That's what I need to do!" I think equal weight is actually sufficient and I'd argue that it's not possible to come up with a universal weighing scheme anyway (especially with the flexibility of conan in terms of settings and options). |
But that is exactly what the output of the missing binary is saying, I am not sure about what you mean: $ conan install zlib/1.2.11@conan/stable -s os=Windows -s compiler="Visual Studio" -s compiler.version=10
...
...
zlib/1.2.11@conan/stable: WARN: Can't find a 'zlib/1.2.11@conan/stable' package for the specified settings, options and dependencies:
- Settings: arch=x86_64, build_type=Release, compiler=Visual Studio, compiler.runtime=MD, compiler.version=10, os=Windows
- Options: minizip=False, shared=False
- Dependencies:
- Package ID: 85f780d0530411a64b0be4407b381706014b445d
ERROR: Missing prebuilt package for 'zlib/1.2.11@conan/stable'
Try to build it from sources with "--build zlib"
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package" Then, the fact that we never ran a build for VS10 should be evident from the output:
And outputting "close" matches is nothing but noise. From my point of view this is the most common case by far. For other cases, the
(the UI is just an idea, not a proposal). |
Maybe the scale of things is different. Or the situation: as a developer you create an artificial situation where you say, "let's create an output for when there is no match for the OS", and then you read the message and it seems very clear. But when you don't know what is mismatching in the first place, it's not clear at all (user's perspective). I find it not evident in a real world scenario with 25 profiles. That's why I detailed the process in my first post. My experience is that this error message shows a "needle and a haystack" and I have to find the needle in an even bigger haystack. It literally says: "here are all the settings and options I computed, one or more of them is wrong, go figure out which, you are on your own". I'll give you another example. Here's an imaginary error message:
And then you search and get:
(this is real output and I planted one setting mismatch) You might be tempted to say, "OK, but I'll obviously filter for Linux", but we still have 8 of those. Can you find which setting is wrong in the above list without pulling hair? Now you are scrolling up and down in your terminal to see the error message and compare to various recipes, lose track of where you were etc. Or you try to be smart and do something like I did in the motivating example in the first post. My point is that this is way too difficult and the error message is not helpful in larger scale projects. But it could be more helpful because all the information is there.
By default, maybe, but on these occasions they would be super useful. That's why I proposed a separate command, but then agreed with the suggestions that a flag would be better. I don't think the default behavior should change. Another informative aspect would be if it could say: "all settings and options matched in all recipes except:
I don't understand this idea. Are you saying that instead of a flag to |
No, I am not suggesting to filter by linux. I was suggesting that the
Yes, I am suggesting doing it in 2 steps. Maybe the command line can be also printed directly in the error output of missing package, so users wanting to know "why" they could copy and paste it. |
Given sufficient output I could implement this in a totally separate tool. I think the only piece missing is json output from |
Ok, could we agree in the UI then? I think it makes sense in |
Hmm, I might disagree on that. The most common use-case would be to find matches for the current settings and options (i.e. after conan install failed). In that case, it would be a lot of legwork to construct the query string which is a different format from the error message (although your suggestion for a copy-pastable pre-made command in the output would help with that). For me, search is a bit different semantically and I think that command is also a bit overburdened similarly to install (since currently search acts as a way to search recipes but also to display their settings/options when a complete package reference is passed). This would add a third, different functionality to search. So maybe a separate subcommand is the way to go after all? Playing with some ideas: Find matching packages for the current settings and options (read from conaninfo.txt):This would be the most frequent use-case; simplest invocation.
Find matching packages for profile
Find matching packages for manually provided settings
etc. I changed my original suggestion of |
Good news everyone. Conan 2.0.15 in #14694 provides the |
I have a relatively frequent use-case which could be automated in conan (maybe as a
conan why
command). First, let me show an example how I do this manually and then I'll proposeconan why
.The example and manual solution
I'm served with a message that looks like this:
Now, in this case I know I have exactly one package in my cache, so I proceed to list its settings and options:
It's not easy to spot the wrong setting or option there, especially that the error message above listed the full_options, but
search
only lists the package options. I don't know where the mismatch is at this moment.So I do the following: I dump the sorted options from the conaninfo.txt from the package I'd expect to be a match, and I dump the options from the error output (breaking up the lines & removing commas manually and sorting both files). So now I have files with contents like this (showing only one for brevity):
Then I diff them:
And there I have my answer.
Needless to say, I was lucky I had only one package. It's much harder to figure out when there are multiple packages. In that case, I usually search with
-q
to reduce the number of hits, but in many cases it's still a lot of legwork to spot what's wrong. I don't always do this diffing process, many times I just scroll up and down and try keep each option and setting in my head.Proposed solution:
conan why
When an install command fails with the error above, I'd like to be able to ask conan what went wrong and what's the closest match. Matches should be ranked by the number of options and settings that matched between the consuming installation context ("wanted") and the package that's being considered for installation. Maybe a percentage value could be used to unify the matching metric. A perfect match is 1.0. My propsed workflow would be (
#
denoting my comments):Ideally, one should be able to limit the number of listed packages, because I'd imagine usually only the first few best matches will be interesting.
I think all the information is present at runtime when
conan install
is executed.What are your thoughts?
To help us debug your issue please explain:
The text was updated successfully, but these errors were encountered: