A guide: How to handle "ERROR: Unsatisfiable requirements detected ..."

Approximately once or twice a week (based on my feelings, not actual stats), I see a post asking about error: How to handle “ERROR: Unsatisfiable requirements detected …”

It’s so common that I think it’s time for a systematic break-down of the issue.

After reading this, you should be able to understand why this happens? and how to handle it.

Deciding a package version
Typically, a Julia package exists in multiple semver version. E.g. 0.1, 0.2, 0.3 etc. In general, when installing a package, the package manager will try to install the latest version of a package.

However, installing the latest version is not always possible due to dependency requirements.

For example, if the latest version of PkgA, say v0.5, requires PkgB v0.4 or lower. Even if PkgB v0.5 exists, install PkgA will only install PkgB v0.4, because the package manager figured out that if it installs PkgB v0.5 then PkgA v0.5 can be installed due to dependency requirements.

As you can imagine, there is a complex web of package dependencies and hence the package manager needs to figure which version of a package can be installed or not. And sometimes, the package manager can’t figure out a set of compatible package versions to install and hence why you see THE error!

This is a recent example:

ERROR: Unsatisfiable requirements detected for package Flux [587475ba]:
 Flux [587475ba] log:
 ├─possible versions are: 0.11.0 or uninstalled
 ├─Flux [587475ba] is fixed to version 0.11.0
 └─restricted to versions 0.10 by GeometricFlux [7e08b658] — no versions left
   └─GeometricFlux [7e08b658] log:
     ├─possible versions are: 0.5.2 or uninstalled
     └─GeometricFlux [7e08b658] is fixed to version 0.5.2

You are will see that there are four indentation levels. The first level (unindented), says Flux [587475ba] log: so it is going to describe the package manager’s experience when trying to install Flux.jl

Firstly you should notice that possible versions are: 0.11.0 or uninstalled is the first sentence of the next level of indentation. Becuase this identation under Flux it is describing that only 0.11.0 of Flux is available. This is odd, because obviousiously Flux 0.10, and 0.9 etc exists. So the fact that it’s so restrictive about the version of Flux means that the user has either deved or pined the version, or tried to install a specific branch of Flux. E.g. trying to install the master branch of Flux can do that.

The next line is telling too Flux [587475ba] is fixed to version 0.11.0 which suggest the same thing as above.

Now the next line is interesting restricted to versions 0.10 by GeometricFlux [7e08b658] — no versions left. Because it’s under the Flux indentation, it is saying trying to apply GeometricFlux dependency restriction, then there is no possible version of Flux left!

Why? See the next indentation levels, which says that Geometric Flux’s possible versions is 0.5.2 due to it being fixed to 0.5.2. So why does that restrict Flux? If you look at the Project.toml for Geometric, I bet you will that it supports up to Flux 0.10 only and hence can’t satisfy Flux0.11!

So how to handle this type of things?
Firstly, the above is a rather simple example, so it still takes practice to understand more complicated example. But keep in mind that it’s due to unsatisfiable dependencies. Hence to handle it we need make the dependencies have a chance of being satisfiable.

  1. Think about downgrading some packages. In the above example, Flux is pinned at 0.11 by the master branch, so perhaps you can Flux the requirement for Flux to 0.10 by ]rm Flux then ]add Flux (technically you can skip ]rm but it’s cleaner to me.
  2. See if main branch of some dependencies already support a higher version. In the above example, maybe the main beach of GeometricFlux already supports Flux 0.11, so if you can’t wait installing that branch would help
  3. Also, the package you install the more likely you will run into issues like this. So another approach to reduce errors like this is to always work inside a project environment e.g. ]activate another-env and install only the package you need for the project into it.
15 Likes

Cf

https://github.com/JuliaLang/Pkg.jl/pull/1798

which is now merged in master and can be read at

https://julialang.github.io/Pkg.jl/dev/managing-packages/#conflicts-1

3 Likes

This is definitely a stumbling block that needs ironing out. I followed your instructions but unfortunately not even uninstalling all the packages in my env helped in Julia 1.5.4. However using the related issue here Getting an error with the Colors package - #2 by fredrikekre I could fix it after deleting the entire .julia/registries folder and its contents, then exiting and restarting Julia.

I think sharing my experience here may be useful. I have often encountered this kind of error recently. The reason for its high frequency is this workflow of mine:

  1. I change a local copy of a Julia project and update its dependencies.
  2. I commit the changes to a git repository (including the Manifest.toml).
  3. I update a copy of the same project on a test server using git pull.
  4. The Julia installation on the server has an out-of-date registry.
  5. The registry does not recognize the versions used on the updated Manifest.toml.

The solution for me is simply executing:

$ julia
julia> import Pkg; Pkg.Registry.update(); Pkg.activate(); Pkg.instantiate();

inside the folder with the updated Manifest.toml.

1 Like

That’s a completely unrelated issue though, you’ve got a corrupted registry

I’d disagree that is is “completely unrelated”. Although the fix/solution are not related, my issue gave the same error message containing “Unsatisfiable requirements…” and this issue was one of the first that came up after a Google. Hopefully this post will help some where @xiaodai’s fix didn’t work.

It also outlines how Julia at the moment isn’t able to run autotests in the background to check if the registry is corrupt before giving “Unsatisfiable requirements…” error messages.

This is a rather generic error message that can happen for many reasons.

Hi everyone, I have an issue I can’t seem to solve. I’m developing my package, here is the Project.toml:

name = "ProtoSyn"
uuid = "c9758760-7c0d-11e9-0ffc-fb9355b7d293"
authors = ["José M. Pereira <...>", "Sergio M. Santos <...>"]
version = "0.4.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
CpuId = "adafc99b-e345-5852-983c-f28acb93d879"
CurveFit = "5a033b19-8c74-5913-a970-47c3779ef25c"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Ghost = "4f8f7498-1303-42e1-920c-5033445536df"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
ONNX = "d0dd6a25-fac6-55c0-abf7-829e0c774d20"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

As you can see, no Flux on the dependencies. Also…

shell> grep Flux Manifest.toml -A 5 -B 5

Doesn’t yield nothing. So clearly, I don’t want to install Flux.jl and I think none of my dependencies requires Flux.jl either. Yet, when I download and install my own package on another fresh install of Julia (no pre-installation of Flux.jl) from my GitHub repo, the following error occurs:

(@v1.7) pkg> add https://github.com/sergio-santos-group/ProtoSyn.jl.git#dev
    Updating git-repo `https://github.com/sergio-santos-group/ProtoSyn.jl.git`
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Adapt [79e6a3ab]:
 Adapt [79e6a3ab] log:
 ├─possible versions are: 0.3.0-3.3.3 or uninstalled
 ├─restricted by compatibility requirements with CUDA [052768ef] to versions: 1.0.0-3.3.3
 │ └─CUDA [052768ef] log:
 │   ├─possible versions are: 0.1.0-3.11.0 or uninstalled
 │   ├─restricted to versions * by ProtoSyn [c9758760], leaving only versions 0.1.0-3.11.0
 │   │ └─ProtoSyn [c9758760] log:
 │   │   ├─possible versions are: 0.4.0 or uninstalled
 │   │   └─ProtoSyn [c9758760] is fixed to version 0.4.0
 │   ├─restricted by julia compatibility requirements to versions: [2.3.0, 2.5.0-3.11.0] or uninstalled, leaving only versions: [2.3.0, 2.5.0-3.11.0]
 │   └─restricted by compatibility requirements with LLVM [929cbde3] to versions: 3.3.3-3.11.0 or uninstalled, leaving only versions: 3.3.3-3.11.0
 │     └─LLVM [929cbde3] log:
 │       ├─possible versions are: 0.9.0-4.14.0 or uninstalled
 │       ├─restricted by compatibility requirements with CUDA [052768ef] to versions: 1.5.0-4.14.0
 │       │ └─CUDA [052768ef] log: see above
 │       └─restricted by julia compatibility requirements to versions: 4.0.0-4.14.0 or uninstalled, leaving only versions: 4.0.0-4.14.0
 ├─restricted by compatibility requirements with CUDA [052768ef] to versions: 3.3.0-3.3.3
 │ └─CUDA [052768ef] log: see above
 └─restricted by compatibility requirements with Flux [587475ba] to versions: 0.3.0-1.1.0 — no versions left
   └─Flux [587475ba] log:
     ├─possible versions are: 0.4.1-0.13.3 or uninstalled
     ├─restricted by compatibility requirements with ONNX [d0dd6a25] to versions: 0.4.1-0.11.6
     │ └─ONNX [d0dd6a25] log:
     │   ├─possible versions are: 0.1.0-0.1.1 or uninstalled
     │   └─restricted to versions * by ProtoSyn [c9758760], leaving only versions 0.1.0-0.1.1
     │     └─ProtoSyn [c9758760] log: see above
     ├─restricted by compatibility requirements with CUDAapi [3895d2a7] to versions: [0.4.1-0.8.3, 0.10.0-0.13.3] or uninstalled, leaving only versions: [0.4.1-0.8.3, 0.10.0-0.11.6]
     │ └─CUDAapi [3895d2a7] log:
     │   ├─possible versions are: 0.5.0-4.0.0 or uninstalled
     │   └─restricted by julia compatibility requirements to versions: uninstalled
     ├─restricted by compatibility requirements with Adapt [79e6a3ab] to versions: 0.8.3-0.13.3 or uninstalled, leaving only versions: [0.8.3, 0.10.0-0.11.6]
     │ └─Adapt [79e6a3ab] log: see above
     ├─restricted by compatibility requirements with CUDA [052768ef] to versions: [0.4.1-0.10.4, 0.12.2-0.13.3] or uninstalled, leaving only versions: [0.8.3, 0.10.0-0.10.4]
     │ └─CUDA [052768ef] log: see above
     └─restricted by compatibility requirements with CuArrays [3a865a2d] to versions: [0.4.1-0.8.3, 0.11.0-0.13.3] or uninstalled, leaving only versions: 0.8.3
       └─CuArrays [3a865a2d] log:
         ├─possible versions are: 0.2.1-2.2.2 or uninstalled
         └─restricted by julia compatibility requirements to versions: uninstalled

Can anyone shed some light on what black magic is going on? I don’t want Flux.jl :sweat_smile: