choco icon indicating copy to clipboard operation
choco copied to clipboard

Already referencing a newer version of 'packagename'

Open ferventcoder opened this issue 9 years ago • 45 comments

Originally referenced at https://github.com/scriptcs/scriptcs/issues/1015

This isn't exactly a bug, but the message might be. See https://nuget.codeplex.com/workitem/1549

Folks can get this when they have a package that limits another package referencing a newer version.

Other references:

  • https://github.com/NuGet/Home/issues/736
  • https://github.com/TheCloudlessSky/Harbour.RedisSessionStateStore/issues/15#issuecomment-38304106

Workaround

Try each of these one at a time and rerun the upgrade to see if it fixes the issue:

  • Set Cache Location as it is more deterministic in cleaning up caches - choco config set cacheLocation c:\ProgramData\choco-cache
  • Look in both C:\ProgramData\chocolatey\lib\everything and `C:\ProgramData\chocolatey\lib\chocolatey-core.extension to verify they only have one nupkg file (without a version in the name of the nupkg). If you find any others, delete them.
  • Run choco upgrade <pkgId> --ignore-dependencies

ferventcoder avatar Apr 07 '15 14:04 ferventcoder

I just had the same error as scriptcs/scriptcs#1015. I noticed that as i uninstalled Nuget.CommandLine chocolatey uninstalled two versions, 2.8.2 and 2.8.5.

2015-04-09 09:43:12,988 [INFO ] - ============================================================
2015-04-09 09:43:13,038 [INFO ] - Chocolatey v0.9.9.4
2015-04-09 09:43:13,128 [INFO ] - Uninstalling the following packages:
2015-04-09 09:43:13,128 [INFO ] - Nuget.Commandline
2015-04-09 09:43:17,688 [INFO ] - 
NuGet.CommandLine v2.8.2
2015-04-09 09:43:18,258 [WARN ] - This is try 1/3. Retrying after 300 milliseconds.
 Error converted to warning:
 Cannot create a file when that file already exists.

2015-04-09 09:43:18,558 [WARN ] - This is try 2/3. Retrying after 400 milliseconds.
 Error converted to warning:
 Cannot create a file when that file already exists.

2015-04-09 09:43:18,958 [ERROR] - Maximum tries of 3 reached. Throwing error.
2015-04-09 09:43:18,968 [WARN ] - Move failed with message:
 Cannot create a file when that file already exists.

 Attempting backup move method.
2015-04-09 09:43:23,838 [INFO ] - 
NuGet.CommandLine v2.8.5
2015-04-09 09:43:23,878 [INFO ] -  Skipping auto uninstaller - No registry snapshot.
2015-04-09 09:43:24,478 [INFO ] -  NuGet.CommandLine has been successfully uninstalled.
2015-04-09 09:43:24,478 [WARN ] - 
Chocolatey uninstalled 2/2 packages. 0 packages failed.

In the logs in scriptcs/scriptcs#1015 it shows that he has nuget 2.8.3 installed but it is trying to uninstall 2.8.2. Could it be an issue with multiple versions of the same package installed at once?

I deleted the files that remained in the lib folder and then scriptcs would install.

nestalk avatar Apr 09 '15 09:04 nestalk

As a workaround, determine if you have multiple versions of nuget.commandline installed by typing

choco list -localonly -all

Then uninstall any version except the most recent.

ferventcoder avatar Apr 09 '15 21:04 ferventcoder

I'm experiencing a simliar issue when upgrading LinkShellExtension, with vcredist2005 in place of nuget.commandline (as commented here )

In this case, I'm vary of uninstalling all but the most recent versions too, since the general recommendation (eg: on SuperUser here and here, on MS Community discussions here ) seems to be against that, instead keeping all these versions side-by-side.

By the way, is there a way to find out which Chocolatey package depends upon each particular version of vcredist2005? I apparently have vcredist2005 8.0.50727.763 and vcredist2005 8.1.0.0 as per clist -lo -all.

digital-carver avatar Jun 09 '15 19:06 digital-carver

which one is actually installed on the machine @digital-carver ?

ferventcoder avatar Jun 09 '15 19:06 ferventcoder

Had this as well.

Before, Link Shell Extension 3.8.6.1 (from the Chocolatey package) and vcredist2005 8.0.61000 und 8.0.56336 were installed.

'cup linkshellextension -y' failed with the above message. 'cinst vcredist2005' claimed it was already installed, even though the package lists its current version as 8.1.0.0 (this package metadata appears to be incorrect). 'cinst vcredist2005 --force' fixed it, even though Control Panel still lists the same versions.

This may be an arch issue, too. linkshellextension gets installed for both x86 and x64, but for x86, only vcredist2005 8.0.56336 is installed, whereas both versions are installed for x64.

chucker avatar Jul 07 '15 13:07 chucker

Thanks for the update.

ferventcoder avatar Jul 07 '15 18:07 ferventcoder

Also @timbrown5

ferventcoder avatar Dec 15 '15 20:12 ferventcoder

This could be a caching issue as well - https://github.com/TheCloudlessSky/Harbour.RedisSessionStateStore/issues/15#issuecomment-38304106

ferventcoder avatar May 07 '17 19:05 ferventcoder

https://chocolatey.org/docs/troubleshooting covers some of this as well.

ferventcoder avatar Nov 06 '17 18:11 ferventcoder

Happens right now with vcredist-all:

PS C:\> cinst -y vcredist-all
Chocolatey v0.10.11
Installing the following packages:
vcredist-all
By installing you accept licenses for the packages.
Progress: Downloading vcredist2005 8.1.0.20160118... 100%
Progress: Downloading vcredist-all 1.0.0... 100%
Progress: Downloading vcredist2008 9.0.30729.6163... 100%
Progress: Downloading vcredist2010 10.0.40219.2... 100%
Progress: Downloading vcredist2012 11.0.61031... 100%
Progress: Downloading vcredist2013 12.0.40660.20180427... 100%
Progress: Downloading vcredist140 14.20.27508.1... 100%
Progress: Downloading chocolatey-core.extension 1.3.3... 100%
Progress: Downloading KB3033929 1.0.4... 100%
Progress: Downloading chocolatey-windowsupdate.extension 1.0.3... 100%
Progress: Downloading KB3035131 1.0.2... 100%
Progress: Downloading KB2999226 1.0.20181019... 100%
Progress: Downloading vcredist2015 14.0.24215.20170201... 100%
Progress: Downloading vcredist2017 14.16.27027.1... 100%
Progress: Downloading vcredist140 14.16.27027.1... 100%
vcredist-all not installed. An error occurred during installation:
 Already referencing a newer version of 'vcredist140'.
vcredist-all package files install completed. Performing other installation steps.
The install of vcredist-all was NOT successful.
vcredist-all not installed. An error occurred during installation:
 Already referencing a newer version of 'vcredist140'.

Dependencies are:

  • vcredist-all 1.0.0 -> vcredist140 (≥ 14.10.25008)
  • vcredist-all 1.0.0 -> vcredist2017 (≥ 14.10.25008)
  • vcredist2017 14.16.27027.1 -> vcredist140 (= 14.16.27027.1) and vcredist140 has newer, approved versions (14.16.27027.20190414, 14.20.27508.1).

Installing explicitly vcredist2017 and then vcredist-all works fine.

(The issue might no longer reproduce once vcredist2017 version 14.16.27027.20190415, which changes the dependency from "=" to "<=", is approved.)

jberezanski avatar Apr 16 '19 10:04 jberezanski

@jberezanski this is expected behavior - I dive into this in more detail at https://github.com/chocolatey/ChocolateyGUI/issues/632#issuecomment-483299453. This is a reason you can't have a single package to depend on that would install multiple versions of something.

ferventcoder avatar Apr 16 '19 13:04 ferventcoder

I'm seeing this with packages that depend on chocolatey-core.extension.

Looking in $env:ChocolateyInstall\lib I see both chocolatey-core.extension and chocolatey-core.extension.1.3.3

The first appears to be version 1.3.4. Manually deleting the chocolatey-core.extension.1.3.3 folder fixed this (and allowed me to upgrade other packages that have a dependency on chocolatey-core.extension again.

flcdrg avatar Nov 15 '19 03:11 flcdrg

I am also having this issue

You have f.lux v4.100 installed. Version 4.111 is available based on your source(s). f.lux not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. f.lux package files upgrade completed. Performing other installation steps. The upgrade of f.lux was NOT successful. f.lux not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. You have f.lux.install v4.100 installed. Version 4.111 is available based on your source(s). f.lux.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. f.lux.install package files upgrade completed. Performing other installation steps. The upgrade of f.lux.install was NOT successful. f.lux.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. You have git v2.21.0 installed. Version 2.24.0 is available based on your source(s). git not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. git package files upgrade completed. Performing other installation steps. The upgrade of git was NOT successful. git not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. You have git.install v2.21.0 installed. Version 2.24.0.2 is available based on your source(s). git.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. git.install package files upgrade completed. Performing other installation steps. The upgrade of git.install was NOT successful. git.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'.

I've not found an extra chocolatey-core.extension where everyone else has, but I did find one in

C:\Users\USER\AppData\Local\NuGet\Cache

Deleting didn't seem to do anything. I'm a bit wary of running the command to ignore dependencies--will it bork anything?

brimwats1 avatar Nov 24 '19 17:11 brimwats1

Manually deleting the chocolatey-core.extension.1.3.3 folder fixed this (and allowed me to upgrade other packages that have a dependency on chocolatey-core.extension again.

this worked perfectly for me. thank you!

charltonstanley avatar Nov 25 '19 00:11 charltonstanley

I went ahead and tried to delete chocolatey-core.extension.1.3.3 -- no luck

You have f.lux v4.100 installed. Version 4.111 is available based on your source(s). f.lux not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. f.lux package files upgrade completed. Performing other installation steps. The upgrade of f.lux was NOT successful. f.lux not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'.

You have f.lux.install v4.100 installed. Version 4.111 is available based on your source(s). f.lux.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'. f.lux.install package files upgrade completed. Performing other installation steps. The upgrade of f.lux.install was NOT successful. f.lux.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'.

& etc

brimwats1 avatar Nov 25 '19 01:11 brimwats1

@brimwats yeah it may not be just that package. In my case I had a few where there were duplicates (or old versions hanging around) that once I manually removed the folders, it unblocked upgrading.

In your case, I'd see if you have multiple chocolatey folders - with one probably having a version number suffix.

flcdrg avatar Nov 25 '19 01:11 flcdrg

@flcdrg would you mind telling me what you think is safe to delete? I generally try to be cautious about rampant deletion of program files image

image

image

image

brimwats1 avatar Nov 25 '19 01:11 brimwats1

(there are about ~7 more pages of .ps1 items after this), I figured they were not relavant)

brimwats1 avatar Nov 25 '19 01:11 brimwats1

Just look in C:\ProgramData\chocolatey\lib and take a closer look where you have 'duplicates' (but only where you know you didn't intentionally install additional versions using the -m parameter).

eg. For me, I can see one that looks a bit odd: image

Looking closer at the contents of those directories, the folder without the version number suffix seems to actually also contain version 1.0.4 files (comparing the .nuspec file contents), so I think I'm safe deleting chocolatey-windowsupdate.extension.1.0.4.

I'm not concerned about all the dotnetcore-sdk.2.1.nnn folders because I intentionally installed those with -m to allow multiple versions of those packages.

flcdrg avatar Nov 25 '19 01:11 flcdrg

No luck with this. However I just took the steps of fully uninstalling and then deleting files manually, then reinstalling flux, git and python which seemed to be fighting me. This seemed to fix it, then I ran cup -all -y again and only got problems with Failures

  • git.install (exited 1) - git.install not upgraded. An error occurred during installation: Already referencing a newer version of 'chocolatey'.

but it's a matter of time before it contines with other packages, ugh

brimwats1 avatar Nov 25 '19 02:11 brimwats1

So out of interest, do you have more than one chocolatey folder in C:\ProgramData\chocolatey\lib ?

flcdrg avatar Nov 25 '19 03:11 flcdrg

Not really? I'm unsure if the extensions, core, dotnet or windows counts as more than one. here's all I have: image

brimwats1 avatar Nov 25 '19 04:11 brimwats1

Ok.. just the one in that folder then.

Also take a look at https://chocolatey.org/docs/troubleshooting#already-referencing-a-newer-version-of-packagename (as pointed to by Rob earlier) in case there's some stray .nupkg files hanging around

flcdrg avatar Nov 25 '19 04:11 flcdrg

I ran these earlier, but didn't get too much:

PS C:\WINDOWS\system32> gci -Path "$env:ChocolateyInstall\lib" -Recurse -Filter "*.nupkg" | %{ $_.FullName } C:\ProgramData\chocolatey\lib\7zip\7zip.nupkg C:\ProgramData\chocolatey\lib\7zip.install\7zip.install.nupkg C:\ProgramData\chocolatey\lib\adobe-creative-cloud\adobe-creative-cloud.nupkg C:\ProgramData\chocolatey\lib\audacity\audacity.nupkg C:\ProgramData\chocolatey\lib\AutoRuns\AutoRuns.nupkg C:\ProgramData\chocolatey\lib\calibre\calibre.nupkg C:\ProgramData\chocolatey\lib\chocolatey\chocolatey.nupkg C:\ProgramData\chocolatey\lib\chocolatey-core.extension\chocolatey-core.extension.nupkg C:\ProgramData\chocolatey\lib\chocolatey-dotnetfx.extension\chocolatey-dotnetfx.extension.nupkg C:\ProgramData\chocolatey\lib\chocolatey-windowsupdate.extension\chocolatey-windowsupdate.extension.nupkg C:\ProgramData\chocolatey\lib\ChocolateyGUI\ChocolateyGUI.nupkg C:\ProgramData\chocolatey\lib\curl\curl.nupkg C:\ProgramData\chocolatey\lib\disable-nvidia-telemetry\disable-nvidia-telemetry.nupkg C:\ProgramData\chocolatey\lib\ditto\ditto.nupkg C:\ProgramData\chocolatey\lib\dotnet4.6.2\dotnet4.6.2.nupkg C:\ProgramData\chocolatey\lib\dotnetfx\dotnetfx.nupkg C:\ProgramData\chocolatey\lib\dropbox\dropbox.nupkg C:\ProgramData\chocolatey\lib\f.lux\f.lux.nupkg C:\ProgramData\chocolatey\lib\f.lux.install\f.lux.install.nupkg C:\ProgramData\chocolatey\lib\filezilla\filezilla.nupkg C:\ProgramData\chocolatey\lib\foobar2000\foobar2000.nupkg C:\ProgramData\chocolatey\lib\git\git.nupkg C:\ProgramData\chocolatey\lib\git.install\git.install.nupkg C:\ProgramData\chocolatey\lib\github-desktop\github-desktop.nupkg C:\ProgramData\chocolatey\lib\imagemagick.app\imagemagick.app.nupkg C:\ProgramData\chocolatey\lib\jre8\jre8.nupkg C:\ProgramData\chocolatey\lib\KB2919355\KB2919355.nupkg C:\ProgramData\chocolatey\lib\KB2919442\KB2919442.nupkg C:\ProgramData\chocolatey\lib\KB2999226\KB2999226.nupkg C:\ProgramData\chocolatey\lib\KB3033929\KB3033929.nupkg C:\ProgramData\chocolatey\lib\KB3035131\KB3035131.nupkg C:\ProgramData\chocolatey\lib\keypirinha\keypirinha.nupkg C:\ProgramData\chocolatey\lib\kubernetes-cli\kubernetes-cli.nupkg C:\ProgramData\chocolatey\lib\Minikube\Minikube.nupkg C:\ProgramData\chocolatey\lib\mm-choco.extension\mm-choco.extension.nupkg C:\ProgramData\chocolatey\lib\netfx-4.6.2\netfx-4.6.2.nupkg C:\ProgramData\chocolatey\lib\nodejs-lts\nodejs-lts.nupkg C:\ProgramData\chocolatey\lib\notepadplusplus\notepadplusplus.nupkg C:\ProgramData\chocolatey\lib\notepadplusplus.install\notepadplusplus.install.nupkg C:\ProgramData\chocolatey\lib\pdfsam\pdfsam.nupkg C:\ProgramData\chocolatey\lib\pdfsam.install\pdfsam.install.nupkg C:\ProgramData\chocolatey\lib\pip\pip.nupkg C:\ProgramData\chocolatey\lib\PowerShellHere\PowerShellHere.nupkg C:\ProgramData\chocolatey\lib\python3\python3.nupkg C:\ProgramData\chocolatey\lib\qbittorrent\qbittorrent.nupkg C:\ProgramData\chocolatey\lib\quicklook\quicklook.nupkg C:\ProgramData\chocolatey\lib\sqlitebrowser\sqlitebrowser.nupkg C:\ProgramData\chocolatey\lib\sqlitebrowser.install\sqlitebrowser.install.nupkg C:\ProgramData\chocolatey\lib\treesizefree\treesizefree.nupkg C:\ProgramData\chocolatey\lib\typora\typora.nupkg C:\ProgramData\chocolatey\lib\vagrant\vagrant.nupkg C:\ProgramData\chocolatey\lib\vcredist140\vcredist140.nupkg C:\ProgramData\chocolatey\lib\vcredist2010\vcredist2010.nupkg C:\ProgramData\chocolatey\lib\vcredist2013\vcredist2013.nupkg C:\ProgramData\chocolatey\lib\vcredist2015\vcredist2015.nupkg C:\ProgramData\chocolatey\lib\virtualbox\virtualbox.nupkg C:\ProgramData\chocolatey\lib\vlc\vlc.nupkg C:\ProgramData\chocolatey\lib\Wget\Wget.nupkg C:\ProgramData\chocolatey\lib\winscp\winscp.nupkg C:\ProgramData\chocolatey\lib\winscp.install\winscp.install.nupkg C:\ProgramData\chocolatey\lib\youtube-dl-gui\youtube-dl-gui.nupkg C:\ProgramData\chocolatey\lib\youtube-dl-gui.install\youtube-dl-gui.install.nupkg C:\ProgramData\chocolatey\lib\youtube-mp3\youtube-mp3.nupkg

The second script doesn't return anything.

brimwats1 avatar Nov 25 '19 04:11 brimwats1

Has anyone had any luck running updates since this was made?

brimwats1 avatar Nov 29 '19 00:11 brimwats1

I got this error when running cup git.

I ran choco list -localonly -all as suggested in this thread and it reported that I had three versions of chocolatey installed.

I ran choco uninstall chocolatey -v 0.0.9.4 and it prompted me for which chocolatey version to uninstall. I chose 0.9.9.4. The command failed, I re-ran choco list -localonly -all and there was only one instance of chocolatey.

Rerunning cup git worked as expected.

Not sure what was going on here, but hope this helps someone.

rikkit avatar Apr 17 '20 14:04 rikkit

This ruby2.devkit package fails to upgrade with this error.

C:\Users\Chloe>choco upgrade ruby2.devkit
Chocolatey v0.10.15
Upgrading the following packages:
ruby2.devkit
By upgrading you accept licenses for the packages.

You have ruby2.devkit v4.7.2.2013022402 installed. Version 4.7.2.2013022403 is available based on your source(s).
Progress: Downloading 7zip.commandline 16.02.0.20170209... 100%
Progress: Downloading 7zip.portable 19.0... 100%
Progress: Downloading ruby2.devkit 4.7.2.2013022403... 100%
ruby2.devkit not upgraded. An error occurred during installation:
 Already referencing a newer version of 'chocolatey-core.extension'.
ruby2.devkit package files upgrade completed. Performing other installation steps.
The upgrade of ruby2.devkit was NOT successful.
ruby2.devkit not upgraded. An error occurred during installation:
 Already referencing a newer version of 'chocolatey-core.extension'.
 Unsuccessful operation for ruby2.devkit.
  Rollback to previous version (package files only)?([Y]es/[N]o): y


Chocolatey upgraded 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - ruby2.devkit (exited 1) - ruby2.devkit not upgraded. An error occurred during installation:
 Already referencing a newer version of 'chocolatey-core.extension'.

--ignore-dependencies worked. That should not be necessary.

starrychloe avatar Oct 16 '20 19:10 starrychloe

This isn't exactly a bug, but the message might be.

I disagree, see: https://github.com/chocolatey/choco/issues/2143#issuecomment-905649744

easybe avatar Aug 25 '21 16:08 easybe

Originally referenced at scriptcs/scriptcs#1015

Workaround

Try each of these one at a time and rerun the upgrade to see if it fixes the issue:

  • Look in both C:\ProgramData\chocolatey\lib\everything and `C:\ProgramData\chocolatey\lib\chocolatey-core.extension to verify they only have one nupkg file (without a version in the name of the nupkg). If you find any others, delete them.

This fixed it for me.

asheroto avatar Apr 23 '22 02:04 asheroto

Hi, in my case chocolatey itself is the package blocking other packages, what do i have to do? Do i have to completely uninstall chocolatey?

I tried this but didn't work:

PS>choco upgrade all
[...]
Chocolatey upgraded 0/108 packages. 2 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - chocolateygui (exited 1) - chocolateygui not upgraded. An error occurred during installation:
 Already referencing a newer version of 'chocolatey'.
 - msys2 (exited 1) - msys2 not upgraded. An error occurred during installation:
 Already referencing a newer version of 'chocolatey'.

PS>choco list -localonly -all|grep -i choco
Chocolatey v1.3.1
chocolatey has been installed as a side by side installation.
chocolatey 1.3.1
chocolatey 1.2.1
chocolatey-compatibility.extension has been installed as a side by side installation.
chocolatey-compatibility.extension 1.0.0
chocolatey-core.extension has been installed as a side by side installation.
chocolatey-core.extension 1.4.0
chocolatey-dotnetfx.extension 1.0.1
chocolateygui 1.1.1
chocolatey-misc-helpers.extension 0.0.4
chocolatey-windowsupdate.extension has been installed as a side by side installation.
chocolatey-windowsupdate.extension 1.0.5

PS>choco --version
1.3.1

PS>choco uninstall chocolatey --version 1.2.1
Chocolatey v1.3.1
Uninstalling the following packages:
chocolatey

chocolatey has been installed as a side by side installation.
Side by side installations are deprecated and is pending removal in v2.0.0.
chocolatey not uninstalled. An error occurred during uninstall:
 Unable to uninstall 'chocolatey 1.2.1' because 'chocolateygui 1.1.1, php 7.4.20, msys2 20230127.0.0, nirlauncher 1.23.66, php 8.2.4, php 8.1.17' depend on it.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - chocolatey (exited 1) - chocolatey not uninstalled. An error occurred during uninstall:
 Unable to uninstall 'chocolatey 1.2.1' because 'chocolateygui 1.1.1, php 7.4.20, msys2 20230127.0.0, nirlauncher 1.23.66, php 8.2.4, php 8.1.17' depend on it.

If a package uninstall is failing and/or you've already uninstalled the
 software outside of Chocolatey, you can attempt to run the command
 with `-n` to skip running a chocolateyUninstall script, additionally
 adding `--skip-autouninstaller` to skip an attempt to automatically
 remove system-installed software. Only the packaging files are removed
 and not things like software installed to Programs and Features.

If a package is failing because it is a dependency of another package
 or packages, then you may first need to consider if it needs to be
 removed as packages have dependencies for a reason. If
 you decide that you still want to remove it, head into
 `$env:ChocolateyInstall\lib` and find the package folder you want to
 be removed. Then delete the folder for the package. You should use
 this option only as a last resort.

aetonsi avatar Mar 31 '23 09:03 aetonsi