Skip to content
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

When installing or upgrading packages with dependencies, the error 'Unable to resolve dependency' is encountered #3496

Open
pauby opened this issue Aug 6, 2024 · 1 comment

Comments

@pauby
Copy link
Member

pauby commented Aug 6, 2024

(NOTE: This is a work in progress that we will continue to update).

This issue has been created to provide additional information on how to resolve dependency issues and to collect these dependency issues together.

When installing or upgrading a package, you may see the error:

[NuGet] One or more unresolved package dependency constraints detected in the Chocolatey lib folder. All dependency constraints must be resolved to add or update packages. If these packages are being updated this message may be ignored, if not the following error(s) may be blocking the current package operation: 'PACKAGE 3.11.4 constraint: PACKAGE (= 3.11.4)'
Unable to resolve dependency 'PACKAGE'. Source(s) used: 'SOURCE'.

(Note PACKAGE and SOURCE can be any package or source and are being used as examples).

There are a few common scenarios we have seen that can lead to this (in no particular order):

  1. You have a meta-package (emacs for example) that depends on another package (emacs.install). The other package (emacs.install) has been uninstalled by some means. This would break the dependency for the meta-package (emacs).

(NOTE: The above list is a work in progress that we will continue to add to).

There are a couple of options available:

  1. Read the dependency documentation and work through the examples.
  2. Watch the YouTube video where we take you through some common scenarios and solutions.
  3. Reach out on our Community Hub.

Please do not raise an issue on this until you have gone through the options above and the Chocolatey Team requests you to. If you do raise an issue before doing the above, it is highly likely it will be closed.

Related Issues

@pauby pauby pinned this issue Aug 6, 2024
@pauby pauby changed the title When installing or upgrading packages with dependencies, the error 'Unable to resolve dependency' is given When installing or upgrading packages with dependencies, the error 'Unable to resolve dependency' is encountered Aug 7, 2024
@penguin359
Copy link

I ran into a similar issue where Chocolatey happily did an upgrade that triggered a dependency resolution error for later operations. Specifically, when installing a new package that had a strict dependency version requirement, it properly installed the correct, older version of it's dependency and both packages worked as expected. However, as the dependency was not the latest version, it shows up as outdated and the choco upgrade command will happily update it to the latest release. The problem is that the upgrade operation does not attempt to detect that this will lead to a broken dependency tree and upgrades the package which the original package depends on. The install completed successfully and the chocolatey database now shows the new version, but now any operations, even for unrelated packages fail due to the broken dependency relationship.

Here is the specific case I hit. I installed ganttproject, a Java app which depends on openjdk, specifically any version in the 0.11.x range. Both packages installed correctly initially and it had selected 11.0.2.01 version of openjdk as the latest available to satisfy the dependencies for gantproject 3.1.3100. However, running choco outdated, it reported that openjdk was outdated as 22.0.2 is currently available. The real problem, however, is that no warnings or errors were thrown when running choco upgrade openjdk. The package was happily updated and ganttproject is now broken. It's not so much that the software might be broken, but that the Chocolatey dependency relationships are now broken and any operations including installing or upgrading unrelated packages will now fail with something similar to following error:

powershell-core - Unable to resolve dependency 'openjdk': Unable to resolve dependencies. 'openjdk 22.0.2' is not compatible with 'ganttproject 3.1.3100 constraint: openjdk (>= 11.0.0 && < 12.0.0)'.

Ideally, an error should have been produced by the upgrade operation and the upgrade for openjdk should have been skipped (while not blocking other unrelated upgrades being requested in the same command). It should not be possible to execute an operation like this that will break Chocolatey. Another alternative would just be for broken dependencies to not block unrelated packages when dependencies are broken, but the preferable solution is to prevent the situation to begin with.

In order for me to continue using Chocolatey, I had to remove ganttproject so I could resume my normal operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants