Pkg.jl
Pkg.jl copied to clipboard
Improve the "empty intersection" error message
When adding a specific version of a package that's incompatible with your project's compat bounds, you will get this error message:
(dev) pkg> add [email protected]
Resolving package versions...
ERROR: empty intersection between [email protected] and project compatibility 1.5.0
It states the minimum information I need to know, but it would be more helpful if it also told me why my project compatibility is 1.5.0
. Is it because of a dependency's compatibility? Is it because I specified that in my project's compat section? In this particular instance, it was because of the latter reason, so I think a more helpful error message would look like:
(dev) pkg> add [email protected]
Resolving package versions...
ERROR: empty intersection between [email protected] and project compatibility 1.5.0
Project log:
├─possible versions are: 1.5.0 or uninstalled
├─source: explicit project compatibility requirement
@ /path/to/Project.toml:25
├─restricted to versions 1.11.1 by an explicit requirement (`add [email protected]`) - no versions left
└─source: `add [email protected]`
@ REPL[1]:1
This error message tells me why my project compatibility is 1.5.0
. It's because I wrote FileIO="=1.5.0"
in my Project.toml
file on line 25
. The error message could state something similar if a dependency is bounding the compatibility, similar to the resolver errors.
Is it because I specified that in my project's compat section?
Always this.
@IanButterworth and I talked offline and we agree that at least printing the compat entry line in the error message would be a big improvement. We feel that just stating project compatibility 1.5.0
doesn't tell the user that it specifically means the [compat]
entry.
In addition, we could change the text project compatibility
to project compatibility (e.g. [compat] entry)
.
project compatibility (e.g. [compat] entry)
Not really e.g.
here because it is only that.
Is it because I specified that in my project's compat section?
Always this.
It seems like it's not always this. I had a confounding problem when I was working on a package (let's call it package B
) which depended on another (let's call it A
, of which I am the developer). I realized that I needed to change A
to get B
working, so I just dev
ed A
in B
, worked on A
until B
worked, and made a new release of A
. After the change made it into the general registry, I altered Project.toml
in B
to restrict to that version of A
(or greater), and tried to update. But I got the error
ERROR: empty intersection between [email protected] and project compatibility 1.1.0-1
It took me much too long to remember that I had dev
ed A
. My brute-force solution was just to delete Manifest.toml
, and update.