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

choco upgrade all upgrades package even if one package requires a specific version #3598

Open
6 tasks done
xavgru12 opened this issue Jan 10, 2025 · 9 comments
Open
6 tasks done

Comments

@xavgru12
Copy link

Checklist

  • I confirm there are no unresolved issues reported on the Chocolatey Status page.
  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.
  • I confirm I am using official, and not unofficial, or modified, Chocolatey products.

What You Are Seeing?

It upgrades a package.

What is Expected?

It keeps the package version as it is required by another package.

How Did You Get This To Happen?

choco upgrade all

System Details

  • Operating System: Windows 11
  • Windows PowerShell version: 5.1.26100.2161
  • Chocolatey CLI Version: 2.4.1
  • Chocolatey Licensed Extension version:
  • Chocolatey License type: community
  • Terminal/Emulator: Powershell

Installed Packages

axivion 7.9.1
chocolatey 2.4.1
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension 1.4.0
chocolatey-windowsupdate.extension 1.0.5
curl 8.11.1
cyg-get 1.2.2
Cygwin 3.5.5
freecommander-xe.install 2025.921.0
git 2.47.1
git.install 2.47.1
git-lfs 3.6.0
git-lfs.install 3.6.0
KB2919355 1.0.20160915
KB2919442 1.0.20160915
KB2999226 1.0.20181019
KB3033929 1.0.5
KB3035131 1.0.3
llvm 19.1.5
make 4.4.1
ninja 1.12.1
notepadplusplus 8.7.5
notepadplusplus.install 8.7.5
obs 0.659.20200402
obs-studio 31.0.0
obs-studio.install 31.0.0
openjdk 17.0.2
poetry 1.8.2
python 3.12.8
python3 3.12.8
tortoisegit 2.17.0.2
vcredist140 14.42.34433
vcredist2015 14.0.24215.20170201
vcredist2017 14.16.27052
vscode 1.96.2
vscode.install 1.96.2
winmerge 2.16.44

Output Log

You have python3 v3.12.8 installed. Version 3.13.1 is available based on your source(s).
[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: 'axivion 7.9.1 constraint: openjdk (>= 17.0.0 && < 18.0.0)', 'python 3.12.8 constraint: python3 (= 3.12.8)'
Re-attempting package dependency resolution using additional available package information...
[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: 'axivion 7.9.1 constraint: openjdk (>= 17.0.0 && < 18.0.0)', 'python 3.12.8 constraint: python3 (= 3.12.8)'
A newer version of openjdk (v22.0.2) is already installed.
 Use --allow-downgrade or --force to attempt to install older versions.
A newer version of python312 (v3.12.8) is already installed.
 Use --allow-downgrade or --force to attempt to install older versions.
Failed to install python3 because a previous dependency failed.
Failed to install python because a previous dependency failed.

Additional Context

No response

@xavgru12 xavgru12 added the Bug label Jan 10, 2025
@xavgru12 xavgru12 changed the title choco upgrade all upgrade package even if one package requires a specific version choco upgrade all upgrades package even if one package requires a specific version Jan 10, 2025
@pauby
Copy link
Member

pauby commented Jan 10, 2025

There is not enough information to investigate this issue.

Please go back to the description and complete 'What you are seeing' and 'What is expected' sections more fully.

@xavgru12
Copy link
Author

What do you possibly need? I am not sure which information is relevant at this point.

@TheCakeIsNaOH
Copy link
Member

The output log is very truncated, it is not the full log file of the entire verbose+debug output of the command.

The "What you are seeing" and "What is expected" are very vague. What package is affected? What is the other package that has the version contraint? What versions are affected? What is the error message you are talking about?
Here is a link that would be good to read through: https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

It looks like you may have a broken dependency, see this page for how to solve it yourself:
https://docs.chocolatey.org/en-us/choco/troubleshooting/dependency-troubles/

@xavgru12
Copy link
Author

I dont think giving the packages names would change anything since it is a custom package (axivion). Do I need to upload the complete package with full info? Axivion requires 17.x of openjdk. upgrade all however upgrades openjdk to 22. Axivion requires a specific Python version as well and upgrade all does not upgrade Python, which is my expected behavior. The question is why it does not do the same for openjdk.

@corbob
Copy link
Member

corbob commented Jan 11, 2025

That's why we ask for the logs. From the output and what you've said, it seems that chocolatey is seeing updates to both of those packages, then when it attempts to upgrade them and it ensures they won't break dependencies if stops and doesn't upgrade them. But without logs it's hard to tell.

@xavgru12
Copy link
Author

Choco is seeing the possible upgrade but is supposed to not upgrade since axivion requires openjdk 17 instead of 22.

@corbob
Copy link
Member

corbob commented Jan 12, 2025

Choco is seeing the possible upgrade but is supposed to not upgrade since axivion requires openjdk 17 instead of 22.

Yes. That's the process Chocolatey takes when it is asked to upgrade:

  1. Determine what packages are being asked to upgrade (in this case the all keyword is translated to the alphabetical list of installed but not pinned packages).
  2. For each item in that list determine if there is an upgraded package available.
  3. If there is an upgraded package available, do dependency resolution on the new package version. AKA: check installed packages and the package to be installed to be sure we can install it.
  4. If we can't with this version, check for versions that meet the dependency contstraints.
  5. If there are no packages that meet the dependency constraints, do not upgrade.

As a reproduction, I created a package with the following nuspec and installed it on a fresh VM:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
  <metadata>
    <id>demo</id>
    <version>1.0.0</version>
    <authors>none</authors>
    <description>Demo package</description>
    <title>demo (Install)</title>
    <dependencies>
      <dependency id="openjdk" version="[17.0.2]" />
      <dependency id="python" version="[3.12.8]" />
    </dependencies>
  </metadata>
</package>

I then ran choco upgrade all, choco upgrade openjdk, and choco upgrade python. All of them behaved as I expected and indicated there was an upgrade available for openjdk and python, but then could not be installed due to dependency constraints.

Image

@xavgru12
Copy link
Author

xavgru12 commented Jan 15, 2025

I have adjujsted your nuspec with my settings. Minimum openjdk version is 17, accepting until 18 which is excluded. With this nuspec, executing choco upgrade all, it upgrades openjdk to 22, which is forbidden.

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
  <metadata>
    <id>demo</id>
    <version>1.0.0</version>
    <authors>none</authors>
    <description>Demo package</description>
    <title>demo (Install)</title>
    <dependencies>
       <dependency id="openjdk" version="[17.0, 18.0)" />
      <dependency id="python" version="[3.12.8]" />
    </dependencies>
  </metadata>
</package>

log:

C:\code\axivionPackage\demo>choco upgrade openjdk
Chocolatey v2.4.1
Upgrading the following packages:
openjdk
By upgrading, you accept licenses for the packages.

You have openjdk v17.0.2 installed. Version 22.0.2 is available based on your source(s).
[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: 'axivion 7.9.1 constraint: openjdk (>= 17.0.0 && < 18.0.0)'
PATH environment variable contains C:\Program Files\OpenJDK\jdk-17.0.2\bin. Removing...
Downloading package from source 'https://community.chocolatey.org/api/v2/'
Progress: Downloading openjdk 22.0.2... 100%

openjdk v22.0.2 [Approved]
openjdk package files upgrade completed. Performing other installation steps.
File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.
Hashes match.
Hashes match.
Extracting C:\Users\gruberx\AppData\Local\Temp\chocolatey\openjdk\22.0.2\openjdk-22.0.2_windows-x64_bin.zip to C:\Program Files\OpenJDK...
C:\Program Files\OpenJDK
PATH environment variable does not have C:\Program Files\OpenJDK\jdk-22.0.2\bin in it. Adding...
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type refreshenv).

@corbob
Copy link
Member

corbob commented Jan 18, 2025

I think you've got something going on with your Chocolatey install, and hence the reason that we ask for the full logs. On a fresh system with the package I am unable to reproduce the issue:

Image

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

4 participants