mpminstall AllowVersionReplacement doesn't seem to work
3 views (last 30 days)
Show older comments
I have a package repository set up as a folder, with a few packages inside created by running mpmcreate(Install=false), and manually setting their version numbers. When I install a package, then advance the version number in remote_repository/TestLibrary/resources/mpackage.json to 1.0.2, and attempt to install by running either of the following commands:
mpminstall("TestLibrary", AllowVersionReplacement=false)
mpminstall("TestLibrary", AllowVersionReplacement=true)
I just get grey text saying "The following packages are already installed: TestLibrary@1.0.1 No additional packages were installed."
When passing false, I do not get an error, as the documentation says I should. When passing true, I do not get a new version of the package installed. Based on the documentation, I expected passing true would reinstall the package, essentially updating it. Is this not the intended behavior? Or have I setup my repository wrong?
For context, if I run:
mpmsearch("TestLibrary")
I get:
Name Version Summary
"TestLibrary" "1.0.2" ""
And if I run:
mpmlist("TestLibrary")
I get:
Name Version Editable InstalledAsDependency
"TestLibrary" "1.0.1" false false
3 Comments
Vidhi Agarwal
on 10 Jul 2025
- Manual Version Edits Are Not Enough: Simply changing the version in `mpackage.json` or the package object does **not** update the package archive used by MPM for installs.
- MPM Relies on Package Archives: MPM checks for new or updated `.mlpkginstall` package archives when installing or updating packages—not just the JSON file.
- Why No Error or Update Occurs: If only the JSON is changed, but the archive isn’t rebuilt, MPM sees no new version available and neither errors nor updates.
- Proper Update Workflow: To release a new version, "change the version" in your package and then "rebuild the archive" using
mpmcreate("ReproducablePackage", localDir, Install=false);
- .Copy the Updated Archive: After rebuilding, copy the new package files (including the updated archive) to your repository folder.
- Now Install Works as Expected: Running below line will now detect and install the new version.
mpminstall("ReproducablePackage", AllowVersionReplacement=true)
Always rebuild the package archive with `mpmcreate` after changing the version, then update your repository. This ensures MPM recognizes and installs the new version.
Hope this helps!
Answers (0)
See Also
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!