Pkg.jl icon indicating copy to clipboard operation
Pkg.jl copied to clipboard

Improve the "empty intersection" error message

Open Octogonapus opened this issue 3 years ago • 5 comments

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.

Octogonapus avatar Sep 22 '21 19:09 Octogonapus

Is it because I specified that in my project's compat section?

Always this.

KristofferC avatar Sep 23 '21 10:09 KristofferC

@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.

Octogonapus avatar Sep 23 '21 14:09 Octogonapus

In addition, we could change the text project compatibility to project compatibility (e.g. [compat] entry).

DilumAluthge avatar Sep 23 '21 14:09 DilumAluthge

project compatibility (e.g. [compat] entry)

Not really e.g. here because it is only that.

KristofferC avatar Sep 29 '21 09:09 KristofferC

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 deved 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 deved A. My brute-force solution was just to delete Manifest.toml, and update.

moble avatar May 22 '22 03:05 moble