As example, I am looking to have multiple versions of same package present on my machine, and switch active version without having to re-download it from chocolatey/nuget server. To take this further, ideally, I'd also want to have sets of package versions (e.g. defined in several chocolatey .config files as per https://github.com/chocolatey/choco/wiki/CommandsInstall#packagesconfig), and switch between those configs with minimal overhead, although if package is missing locally, of course it would need to be downloaded). Does chocolatey allow for this kind of mechanism, and if not - what is the closest that I can get to it? Is this better managed with switching default package source, and have each source have an appropriate version as latest?
1 Answer
Have a look at the documentation for the install command here:
https://chocolatey.org/docs/commands-install
Specifically, here:
-m, --sxs, --sidebyside, --side-by-side, --allowmultiple, --allow-multiple, --allowmultipleversions, --allow-multiple-versions
AllowMultipleVersions - Should multiple versions of a package be installed? Defaults to false.
So yes, it is possible to have multiple versions of the same package installed, however, it depends on "what" exactly is happening in the package, and the underlying installer, if this will actually result in two installations that will work independently of each other.
-
1Even though you can, it's technically not recommended. The better thing to do is to have a package name with a major version in it, similar to the ruby debian packages. Commented Feb 4, 2019 at 18:00
-
It is not something you decide, it could be a requirement by other software. For example some software require Python 2, but other require Python 3. Similary PHP 7.x and PHP 8, or node 16 vs 17 vs 18 Commented Oct 30, 2022 at 4:35
-
2Although this answer is still valid right now, Chocolatey is currently outputting "
installing the same package with multiple versions is deprecated and will be removed in v2.0.0.
" when I do a side-by-side install like this. I have no idea when v2.0.0 will arrive or what the chances are of its reprieving the side-by-side installs after all.– AJMCommented May 5, 2023 at 17:04 -
Additionally, I think
llvm
is an example of a package for which you can't have a side-by-side install, and that even with--side-by-side
specified the most recently installed version will just replace the old. If I am wrong about that, someone please correct me!– AJMCommented May 5, 2023 at 18:24