Can't figure out how to dev-install unregistered package

I’ve created folder test with the following Project.toml:

QuantumControlBase = "f10a33bc-5a64-497c-be7b-6f86b4f0c2aa"
GRAPELinesearchAnalysis = "290eba36-e2d8-4488-81b6-f66cc44f2186"

julia = "1.6"

There is no Manifest.toml in the test folder.

I have a checkout of both QuantumControlBase and GRAPELinesearchAnalysis in sibling folders of test. QuantumControlBase is in the standard registry while GRAPELinesearchAnalysis is unregistered. GRAPELinesearchAnalysis depends on QuantumControlBase (and other registered packages in JuliaQuantumControl), but not vice versa. I want to start a REPL using both packages in dev-mode based on the local checkout I have. Here is what I get when I try to dev-install the packages:

goerz@ophelia master:~/JuliaQuantumControl> julia --project=test
   _       _ _(_)_     |  Documentation:
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.6.1 (2021-04-23)
 _/ |\__'_|_|_|\__'_|  |  Official release
|__/                   |

julia> import Pkg

julia> Pkg.develop(path="./QuantumControlBase.jl/")
Path `./QuantumControlBase.jl/` exists and looks like the correct package. Using existing path.
   Resolving package versions...
ERROR: expected package `GRAPELinesearchAnalysis [290eba36]` to be registered

I’ve run into this same problem before when trying to develop the various packages in the JuliaQuantumControl org. All of these should be tested against each other’s master or uncommitted versions, both locally and on CI (see the setup in the various projects’ Makefile and CI.yml). I haven’t been able to make this work at all while any of the packages were unregistered.

So far, I’ve worked around that by registering packages a bit “pre-maturely” as 0.0.1 versions, but for GRAPELinesearchAnalysis I don’t think I even want that to be registered: it’s just a debugging tool, plus the 3-day wait/review period for a new package will be a hassle for something that I want to quickly push out to a collaborator.

I’m just about ready to explore setting up my own registry, which would probably get around this problem, but is there really no way to instantiate an environment with dev-versions of unregistered packages?

To boil this down to a more minimal description: Best I can tell, if a Project.toml contains any unregistered package, then any Pkg operation (add, develop, etc) in the environment will error out.

I can get around that by installing the unregistered package first, but that’s not always possible, and it stops working if there is more than one unregistered package.

You need to install unregistered package in “dependency order”, e.g. the one with no unregistered deps first, then the one that depends on that one etc. Should always work.


Thanks! That works indeed!

In this particular case, manually keeping track of the dependency structure across the entire organization (and test/docs Project.toml files) would be quite burdensome. So I ended up with a local registry instead, which also solves the problem quite nicely. I was actually surprised how easy the process of setting up a registry was, thanks to GunnarFarneback/LocalRegistry.jl.

Still, it would be nice if Project.toml had a better way of dealing with unregistered packages. Maybe a new section in Project.toml specifically for unregistered packages that serves as an “ad-hoc” registry, linking package names/UUIDs to git repos, so that Pkg wouldn’t have to complain.

Yea, see #492 in Pkg.jl.

1 Like