I’m trying with this code in the first cell to download config files to a temp directory:
begin
using Downloads
using Pkg
owd = pwd()
if isfile(joinpath("..","Manifest.toml")) && isfile(joinpath("..","Project.toml"))
cd("..")
Pkg.activate(".")
Pkg.resolve()
Pkg.instantiate()
cd(owd)
elseif isfile(joinpath(".","Manifest.toml")) && isfile(joinpath(".","Project.toml"))
Pkg.activate(".")
Pkg.resolve()
Pkg.instantiate()
else
manifest_url = "https://URL/to/Manifest.toml"
project_url = "https://URL/to/Project.toml"
temp_dir = mktempdir(".",cleanup=true)
Downloads.download(manifest_url,joinpath(owd,temp_dir,"Manifest.toml"))
Downloads.download(project_url,joinpath(owd,temp_dir,"Project.toml"))
cd(temp_dir)
Pkg.activate(".")
Pkg.instantiate()
cd(owd)
end
end
In some projects, I have these files in a folder just above the notebook. In others, I have them in the same folder. If it’s running on Binder, they won’t be in either location, so we can make a temp directory and download them from the repository, then activate and instantiate on that directory.
It works well locally and on Binder on simple test cases, but on my real notebook, I’m getting this error running the notebook on Binder:
expected package `QOI [4b34888f]` to be registered
pkgerror(::String)@Types.jl:55
check_registered(::Pkg.Types.Context, ::Vector{Pkg.Types.PackageSpec})@Operations.jl:1157
var"#instantiate#253"(::Nothing, ::Bool, ::Bool, ::Base.BinaryPlatforms.Platform, ::Bool, ::Bool, ::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(Pkg.API.instantiate), ::Pkg.Types.Context)@API.jl:1372
instantiate@API.jl:1325[inlined]
#instantiate#252@API.jl:1321[inlined]
instantiate()@API.jl:1321
top-level scope@
Some solutions suggest deleting the registry to fix it, but I can’t do that on Binder.
Or to update the registry with Pkg.Registry.update()
. This also did not solve it.
I tried deleting the Manifest.toml and runing pkg> instantiate
again to make it fresh, but that yields the same error.
Linking to newly created issues on QOI and Pluto on Binder (don’t know if these are the issue or not).