How to prevent version upgrade when adding package?

In the particular scenario, Flux.jl depends on Zygote.jl,
so Pkg.add("Flux") also adds a version of Zygote behind the scene.

However, when it is necessary to access something in Zygote,
it is still necessary to explicitly Pkg.add(“Zygote”), even though a
version of Zygote is already loaded.

The question and issue: currently when doing this,
it triggers a package upgrade, Zygote v0.4.13 -> v0.4.17

That is probably a good thing, however my program needs to be exactly reproducable, and so I want to be in control of when packages change versions.

How can I prevent Pkg.add() from changing the version of the added package.

1 Like

There are several answers to this. One answer is to add Zygote directly, which will tell the package manager not to mess with it (unless you tell it to). A perhaps more practical one is to trust semantic versioning to know that v0.4.13 and v0.4.17 should be compatible since they just differ by point releases.

1 Like

See Pkg.pin.

1 Like

Thank you I think both of these would work