# How to prevent version upgrade when adding package?

**URL:** https://discourse.julialang.org/t/how-to-prevent-version-upgrade-when-adding-package/38464
**Category:** New to Julia
**Created:** [April 30, 2020, 4:42am UTC](https://discourse.julialang.org/t/how-to-prevent-version-upgrade-when-adding-package/38464 "2020-04-30T04:42:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jaynick](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jaynick](https://discourse.julialang.org/u/jaynick)
#### Post date: [April 30, 2020, 4:42am UTC](https://discourse.julialang.org/t/how-to-prevent-version-upgrade-when-adding-package/38464/1 "2020-04-30T04:42:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [April 30, 2020, 5:05am UTC](https://discourse.julialang.org/t/how-to-prevent-version-upgrade-when-adding-package/38464/2 "2020-04-30T05:05:51Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [April 30, 2020, 6:32am UTC](https://discourse.julialang.org/t/how-to-prevent-version-upgrade-when-adding-package/38464/3 "2020-04-30T06:32:11Z")

</div>

See [`Pkg.pin`](https://julialang.github.io/Pkg.jl/dev/api/#Pkg.pin).

---

<div class="post-metadata">

### Author: ![jaynick](https://avatars.discourse-cdn.com/v4/letter/j/71c47a/32.png) [@jaynick](https://discourse.julialang.org/u/jaynick)
#### Post date: [April 30, 2020, 5:52pm UTC](https://discourse.julialang.org/t/how-to-prevent-version-upgrade-when-adding-package/38464/4 "2020-04-30T17:52:14Z")

</div>

Thank you I think both of these would work
