# Problem updating a \*single\* package

**URL:** <https://discourse.julialang.org/t/problem-updating-a-single-package/70619>\
**Category:** General Usage\
**Created:** [October 29, 2021, 12:38pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619 "2021-10-29T12:38:15Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![erans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erans/32/22032_2.png) [@erans](https://discourse.julialang.org/u/erans)\
**Post date:** [October 29, 2021, 12:38pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/1 "2021-10-29T12:38:15Z")

</div>

Hi,

I have a non registered package that I added with

```julia
] add https://github.com/.../MyPkg.git

```

so that when I do `] status` I see:

```julia
(@v1.6) pkg> status
[...]
MyPkg v0.1.0 `https://github.com/.../MyPkg.git#main`

```

Now, I work on the package a bit and want to get the updates in my base environment, so I do:

```julia
(@v1.6) pkg> up MyPkg

```

However, what happens is that _all_ packages are updated. Why??  
According to [The Pkg.jl Documentation](https://pkgdocs.julialang.org/v1/managing-packages/#updating) this is what I need to do.

The issue is, that I also have packges like Plots.jl in my base environment, and when they update, downloding the GR artifact and compiling `GR_jll` takes around 5 minutes 😶

What am I doing wrong? not understanding? etc.

Thanks!

**Note:** this `MyPkg` is very light weight so it is not as if it should have any dependency conflicts…and besides that seems to not be relevant since in the Pkg Documentation it states:  
" If `Example` has a dependency which is also a dependency for another explicitly added package, that dependency will not be updated."

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [October 29, 2021, 1:34pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/2 "2021-10-29T13:34:45Z")

</div>

Yes, `up MyPkg` has some issues: [https://github.com/JuliaLang/Pkg.jl/issues/2344](https://github.com/JuliaLang/Pkg.jl/issues/2344).

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [October 29, 2021, 2:11pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/3 "2021-10-29T14:11:07Z")

</div>

Why isn’t `preserve` the default for both? For me this has been a considerable headache, given that my internet connection is less than ideal many times.

I’m asking out of sincere curiosity about the design decision that led to this behavior.

In my humble opinion, adding or updating a single package should only update the necessary dependencies and whatever else needed for dependency consistency, but nothing else. Currently inadvertently as adding or updating even a dummy package triggers updating everything.

---

<div class="post-metadata">

**Author:** ![erans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erans/32/22032_2.png) [@erans](https://discourse.julialang.org/u/erans)\
**Post date:** [October 29, 2021, 7:32pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/4 "2021-10-29T19:32:25Z")

</div>

Am I understanding [this comment](https://github.com/JuliaLang/Pkg.jl/issues/2344#issuecomment-942226805) from @oxinabox that if I `] up MyPackage@0.1.0` I actually _would_ get the behavior that I want? Or is it currently simply not possible to update a single package?

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [October 29, 2021, 9:32pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/5 "2021-10-29T21:32:41Z")

</div>

It is not currently possible.  
That command with update that package with restrictions.  
But will leave all other packages not mentioned as unrestricted and allow them to update freely.

Current behaviour is pretty unintuitive, and not very useful.

---

<div class="post-metadata">

**Author:** ![erans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erans/32/22032_2.png) [@erans](https://discourse.julialang.org/u/erans)\
**Post date:** [October 29, 2021, 11:36pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/6 "2021-10-29T23:36:41Z")

</div>

To bad 🙁  
Thanks for the clarification though.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [October 29, 2021, 11:45pm UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/7 "2021-10-29T23:45:30Z")

</div>

If you are iterating in the development stage of your package, perhaps `]dev`’ing and using revise would help you with your workflow.

---

<div class="post-metadata">

**Author:** ![erans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erans/32/22032_2.png) [@erans](https://discourse.julialang.org/u/erans)\
**Post date:** [October 30, 2021, 6:21am UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/8 "2021-10-30T06:21:43Z")

</div>

I do that actually, but I actually don’t do much with this specific package. Thanks though.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 30, 2021, 7:14am UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/9 "2021-10-30T07:14:30Z")

</div>

Just two more things to add here:

First, don’t add packages to your default environment unless they are dev packages like Revise, Pluto etc. Use project environments instead, where you only add the packages relevant to a specific bit of analysis. In that way updating the environment does not affect completely unrelated packages used for other purposes in other environments.

Second, you can `pin` packages in an environment to ensure `up` doesn’t affect them.

---

<div class="post-metadata">

**Author:** ![erans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erans/32/22032_2.png) [@erans](https://discourse.julialang.org/u/erans)\
**Post date:** [October 30, 2021, 7:34am UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/10 "2021-10-30T07:34:22Z")

</div>

Thanks for the tips!

I like the `pin` option with the one downside that it sort of works in reverse: instead of saying “please only update _this_ package” it says “do not update this one”

As to adding packages to the base environment: I struggle here.  
My main issue is with how long it takes Plots.jl to update (at least that seems to be what’s causing must of the delays).  
I’m of the opinion, however, that Plots.jl should _not_ be a package dependency if that can be avoided, since  
A) it’s big and  
B) the analysis and how it is presented usually can and should be separated.

Granted, if I never work in the base environment, then Plots.jl will never update 🙂

Finally, the specific package that motivate this thread is essentially something to save various templates and as such doesn’t really helping in any one specific project.  
I didn’t mention that though because I don’t think my specific use case is that important to the general public 😅

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 30, 2021, 7:43am UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/11 "2021-10-30T07:43:20Z")

</div>

That’s entirely fair, I actually have `Plots` and `DataFrames` in my default environment as well given how often I’m doing something just to answer questions on here or SO that involve those packages.

A very specific solution to this issue then would be to just make a sysimage with PackageCompiler that has Plots in it. That way you’d only spend 10 minutes once every few weeks or months re-compiling with a new Plots version when you need it and otherwise have instantaneous startup (and plotting!) speed without any recompilation issues in between.

---

<div class="post-metadata">

**Author:** ![erans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erans/32/22032_2.png) [@erans](https://discourse.julialang.org/u/erans)\
**Post date:** [October 30, 2021, 7:51am UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619/12 "2021-10-30T07:51:44Z")

</div>

Cool. I’m not familiar with PackageCompiler or sysimage but I’ll look into it.
