Adding a package while using Revise.jl crashes

I load Revise.jl in my startup file as follows:

# ensure that every Julia session uses Revise
atreplinit() do repl
    try
        @eval using Revise
        @async Revise.wait_steal_repl_backend()
    catch
    end
end

Everytime I try to add or up a package, I get

ArgumentError: Package CodeTracking not found in current path:
- Run `import Pkg; Pkg.add("CodeTracking")` to install the CodeTracking package.  

I usually have to start up my REPL by running julia --startup-file=no and the error goes away.

Is this a known bug or should I open an issue?

It’s not a problem for most people:

tim@diva:~$ JULIA_DEPOT_PATH=/tmp/pkgs julia -q    # start with a fresh Pkg directory
(v1.2) pkg> add Revise
   Cloning default registries into `/tmp/pkgs`
   Cloning registry from "https://github.com/JuliaRegistries/General.git"
     Added registry `General` to `/tmp/pkgs/registries/General`
 Resolving package versions...
 Installed CodeTracking ─────── v0.5.8
 Installed LoweredCodeUtils ─── v0.3.8
 Installed OrderedCollections ─ v1.1.0
 Installed Revise ───────────── v2.1.10
 Installed JuliaInterpreter ─── v0.7.2
  Updating `/tmp/pkgs/environments/v1.2/Project.toml`
  [295af30f] + Revise v2.1.10
  Updating `/tmp/pkgs/environments/v1.2/Manifest.toml`
  [da1fd8a2] + CodeTracking v0.5.8
  [aa1ae85d] + JuliaInterpreter v0.7.2
  [6f1432cf] + LoweredCodeUtils v0.3.8
  [bac558e1] + OrderedCollections v1.1.0
  [295af30f] + Revise v2.1.10
  [2a0f44e3] + Base64 
  [ade2ca70] + Dates 
  [8ba89e20] + Distributed 
  [7b1f6079] + FileWatching 
  [b77e0a4c] + InteractiveUtils 
  [76f85450] + LibGit2 
  [56ddb016] + Logging 
  [d6f4376e] + Markdown 
  [44cfe95a] + Pkg 
  [de0858da] + Printf 
  [3fa0cd96] + REPL 
  [9a3f8284] + Random 
  [ea8e919c] + SHA 
  [9e88b42a] + Serialization 
  [6462fe0b] + Sockets 
  [8dfed614] + Test 
  [cf7118a7] + UUIDs 
  [4ec0a83e] + Unicode 

(v1.2) pkg>            # here I hit ^D to exit Julia, so you could see startup
tim@diva:~$ JULIA_DEPOT_PATH=/tmp/pkgs julia -q    # I load Revise from my startup.jl
[ Info: Precompiling Revise [295af30f-e4ad-537b-8983-00126c2a3abe]
julia> 1+1
2

My guess is perhaps you circumvented the package manager when installing Revise? Or came to this place from a very old directory?

I see this from time to time as well. It happens when I have loaded a package and then make an update.

I also get similar errors, but never got around to reproduce it so I could open an issue. Seems to happen when I install packages from another instance of Julia.

Ah, now I get it. I think this is https://github.com/timholy/Revise.jl/issues/337. I could have sworn I fixed that, but I must be thinking of something else.

I think the problem occurs when Revise tries to revise a package it itself depends on. It should only happen when JuliaInterpreter, CodeTracking, or LoweredCodeUtils updates, and probably not all the time even then. I will see if I can get to it at some point.

1 Like