Updated to Julia1.2 Pkg status empty and problems adding Plots

Hi

This is my first foray back into using Julia since about a year and had fun playing with DifferentialEquationsExamples in JupyterLab last night using Julia 1.1.1

Just now I updated to Julia1.2 using brew cask upgrade on my MacBook, and when i started it and went to see the Pkg status it read:

(v1.2) pkg> status
    Status `~/.julia/environments/v1.2/Project.toml`
  (empty environment)

Then tried to add Plots to see what would happen:

(v1.2) pkg> add Plots
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.2/Project.toml`
  [91a5bcdd] + Plots v0.26.2
  Updating `~/.julia/environments/v1.2/Manifest.toml`
  [b99e7846] + BinaryProvider v0.5.6
  [3da002f7] + ColorTypes v0.8.0
  [5ae59095] + Colors v0.9.6
  [34da2185] + Compat v2.1.0
  [d38c429a] + Contour v0.5.1
  [9a962f9c] + DataAPI v1.0.1
  [864edb3b] + DataStructures v0.17.0
  [c87230d0] + FFMPEG v0.2.2
  [53c48c17] + FixedPointNumbers v0.6.1
  [28b8d3ca] + GR v0.41.0
<snipped rest for brevity>

Seems like they were there ?

Quickly skimmed help for Pkg and decided to garbage collect, and ran gc which deleted 420 packages:

(v1.2) pkg> gc
    Active manifests:
        `~/.julia/environments/v1.0/Manifest.toml`
        `~/.julia/environments/v1.1/Manifest.toml`
        `~/.julia/environments/v1.2/Manifest.toml`
   Deleted `~/.julia/packages/AbstractFFTs/wfF4f` (26.213 KiB)
   Deleted `~/.julia/packages/Adapt/zZG7Z` (8.235 KiB)
   Deleted `~/.julia/packages/Arpack/UiiMc` (1020.292 KiB)
   Deleted `~/.julia/packages/ArrayInterface/64mDO` (5.534 KiB)
   Deleted `~/.julia/packages/ArrayInterface/qMMsu` (5.549 KiB)
   Deleted `~/.julia/packages/Atom/BXRAC` (90.789 KiB)
<snipped>
 Deleted 420 package installations (1003.564 MiB)

OK. so lets start from scratch:

brew cask uinstall julia
rm -rf ~/.julia
brew cask install julia

try to add Plots back and get this error:

Building GR ────→ `~/.julia/packages/GR/ZI5OE/deps/build.log`
ERROR: IOError: getcwd: no such file or directory (ENOENT)

Does anyone know how to prevent an update to Julia not messing up the packages and how to install Plots again ?

:beers:

OK, I figured out why the build of Plots was not working. Turns out I ran Julia from the terminal while under one of the ~/.julia subfolders, specifically one of the DifferentialEquationExamples when I was running JupyterLab. This was after manually blowing away ~/.julia folder, my terminal session was still in the no longer exiting folder which caused path problems.

Due to the way JupyterLab runs you can not navigate to folders above the path you ran the command jupyter lab from, so I decided to change to where the examples were located under ~/.julia, and start JupyterLab from there.

Now i wonder wether simply updating Julia from a ~/.julia subfolder causes problems with brew cask upgrade and getting the Pkg status ?

Updating Julia doesn’t mess up any packages. If you want to have the same packages installed in 1.2 as 1.1 you can simply copy the folder ~/.julia/environments/v1.1 to ~/.julia/environments/v1.1. Note that this folder only contains two small text files that list what packages are available for that version. The actual packages themselves are stored somewhere else so there is no duplication of packages between julia versions.

2 Likes

Thanks for the reply, not obvious at all to someone new, especially coming from MATLAB where it’s just simple click to update to new release. Perhaps that step could be automated. Anyway now I know not to wholesale blow away ~/.julia :stuck_out_tongue_winking_eye:

So whats with gc, why did that delete the packages then ?

It only delete packages that are not reachable from any of your projects. It only saves some space on your device but doesn’t change anything (which is what a garbage collector is supposed to do).

1 Like

Thanks Kristoffer, borking stuff early on is better than later I guess. Good time for me to start learning how this whole Pkg thing works.

Perhaps a more graceful upgrade experience to a newer version of Julia instead of an empty packages message would go a long way to newer users.

1 Like

Yes, it has been discussed, https://github.com/JuliaLang/julia/pull/28631.

Great, hopefully something comes from the enhancement requests for future users :beers: