Adding package to new environment takes long time?

I have already installed DifferentialEquations.jl in many different environments.

I just created a new environment and did ]add DifferentialEquations

This took > 5 mins, and then precompilation happened for another maybe 5 mins.

The same thing is now happening with GLMakie. Should it take up to 20 minutes just to create and use a new environment with packages that are already installed somewhere? Do new environments not reuse existing installations of packages?

Should it take up to 20 minutes just to create and use a new environment with packages that are already installed somewhere?

No

Do new environments not reuse existing installations of packages?

No

Can you confirm that you have ~/.julia/packages/DifferentialEquations?

Confirmed

.julia/packages/DifferentialEquations contains two folders:
image
so some form of the package has been installed since March 10th.

What happens if you now install DifferentialEquations.jl in a third environment?
I guess you are using two versions of the same package.

It is now much quicker, so it is reusing what was installed earlier.

I assume the solution is to just run ]up more frequently. I just don’t use an environment with DifferentialEquations in very often. When installing packages in the future I will just force it to install a version that already exists so I don’t have to wait.

I was just surprised it took so long to update the package. If I added a third package, I am waiting up to 30+ minutes before I can do anything in my new environment. Perhaps that’s just how it is.

If you add this to your startup.jl file:

Pkg.UPDATED_REGISTRY_THIS_SESSION[] = true

It should update less often and reuse installed packages more.

3 Likes

That’s brilliant, cheers!

I recommend JULIA_PKG_PRESERVE_TIERED_INSTALLED.

More on the --preserve argument for ] add (taken from ]?add):

Argument         Description
  –––––––––––––––– ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
  installed        Like all except also only add versions that are already installed
  all              Preserve the state of all existing dependencies (including recursive dependencies)
  direct           Preserve the state of all existing direct dependencies
  semver           Preserve semver-compatible versions of direct dependencies
  none             Do not attempt to preserve any version information
  tiered_installed Like tiered except first try to add only installed versions
  tiered           Use the tier that will preserve the most version information while
                   allowing version resolution to succeed (this is the default)

Relatedly: Make `PRESERVE_TIERED_INSTALLED` the default Β· Issue #3905 Β· JuliaLang/Pkg.jl Β· GitHub

4 Likes

Thank you! I think I will make this the default