Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlutoPkg fails if the same package name is in Local and General Registry #1937

Open
lungben opened this issue Feb 21, 2022 · 1 comment
Open
Labels
package manager Pluto's built-in package manager

Comments

@lungben
Copy link
Contributor

lungben commented Feb 21, 2022

If I want to add a new package in a Pluto notebook and the package name is used both in the General registry and in a private/ local registry, this fails:

    Updating registry at `C:\Users\xxx\.julia\registries\JuliaRegistry`
    Updating git-repo `https://gitlab.internal.xxx.dev/benjamin/JuliaRegistry.jl.git`
    Updating registry at `C:\Users\xxx\.julia\registries\General.toml`
    Updating registry done ✓
┌ Warning: PlutoPkg: Failed to add/remove packages! Resetting package environment...
│   PLUTO_VERSION = v"0.18.0"
│   VERSION = v"1.7.2"
│   old_packages = String[]
│   new_packages =
│    1-element Vector{String}:
│     "MarketRisk"
│   exception =
│    there are multiple registered `MarketRisk` packages, explicitly set the uuid
│    Stacktrace:
│      [1] pkgerror(msg::String)
│        @ Pkg.Types C:\Users\xxx\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\Types.jl:68
│      [2] registered_uuid(registries::Vector{Pkg.Registry.RegistryInstance}, name::String)
│        @ Pkg.Types C:\Users\xxx\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\Types.jl:948
│      [3] registry_resolve!(registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec})
│        @ Pkg.Types C:\Users\xxx\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\Types.jl:850
│      [4] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
│        @ Pkg.API C:\Users\xxx\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:255
│      [5] (::Pluto.var"#121#135"{Vector{String}, Pluto.Notebook, Pluto.IOListener})()
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:166
│      [6] withinteractive(f::Pluto.var"#121#135"{Vector{String}, Pluto.Notebook, Pluto.IOListener}, value::Bool)
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:495
│      [7] #120
│        @ C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:152 [inlined]
│      [8] withio(f::Pluto.var"#120#134"{Vector{String}, Pluto.Notebook, Pluto.IOListener}, ctx::Pkg.Types.Context, io::IOContext{IOBuffer})
│        @ Pluto.PkgCompat C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\PkgCompat.jl:129
│      [9] (::Pluto.var"#114#127"{Pluto.Notebook, Pluto.IOListener, Vector{String}, Vector{String}, Bool, Bool})()
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:151
│     [10] withtoken(f::Pluto.var"#114#127"{Pluto.Notebook, Pluto.IOListener, Vector{String}, Vector{String}, Bool, Bool}, token::Pluto.Token)
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\evaluation\Tokens.jl:19
│     [11] sync_nbpkg_core(notebook::Pluto.Notebook; on_terminal_output::Pluto.var"#iocallback#143"{Pluto.ServerSession, Pluto.Notebook})
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:103
│     [12] #141
│        @ C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:262 [inlined]
│     [13] withtoken(f::Pluto.var"#141#142"{Pluto.ServerSession, Pluto.Notebook}, token::Pluto.Token)
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\evaluation\Tokens.jl:19
│     [14] sync_nbpkg(session::Pluto.ServerSession, notebook::Pluto.Notebook; save::Bool)
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:253
│     [15] (::Pluto.var"#209#212"{Bool, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Pluto.ServerSession, Pluto.Notebook, Pluto.NotebookTopology})()
│        @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\evaluation\Run.jl:458
│     [16] macro expansion
│        @ C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\evaluation\Tokens.jl:101 [inlined]
│     [17] (::Pluto.var"#184#185"{Pluto.var"#209#212"{Bool, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, Pluto.ServerSession, Pluto.Notebook, Pluto.NotebookTopology}})()
│        @ Pluto .\task.jl:423
└ @ Pluto C:\Users\xxx\.julia\packages\Pluto\2DPK4\src\packages\Packages.jl:286

The Julia REPL offers a selection in the same situation:

(jl_nPj58R) pkg> add MarketRisk
There are multiple registered `MarketRisk` packages, choose one:
 > Registry: JuliaRegistry - Repo: https://gitlab.internal.xxx.dev/benjamin/marketrisk.jl.git - UUID: 4464747a-2b55-41d9-8dca-e6f80a96fed3
   Registry: General - Repo: https://github.com/mpkuperman/MarketRisk.jl.git - UUID: a023d85a-3a31-486e-88e8-289a01a8187b

In order to reproduce this, you need to have a private Registry added to Julia (] registry add myregistry) and have a package registered there with the same name as one in General registry.

I know that this is quite an edge-case and a fix may be difficult, but nevertheless I wanted to document it.

Workaround: switch off PlutoPkg and use manual package management in the notebook.

@fonsp fonsp added the package manager Pluto's built-in package manager label Feb 21, 2022
@fonsp
Copy link
Owner

fonsp commented Feb 23, 2022

Some more info in #1873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package manager Pluto's built-in package manager
Projects
None yet
Development

No branches or pull requests

2 participants