How to automatically add dependencies?

I have written a small package, and uploaded it to github: Bai-Zhan/GluonModel

I have also written another package, which depends on this GluonModel package: Bai-Zhan/ColdDSE.

Now I want to install the ColdDSE package in a clean environment with

] add https://github.com/Bai-Zhan/ColdDSE.git

I would expect that it will also install the GluonModel package since it is in the dependency list of ColdDSE. However, there appears an error message reading:

ERROR: Unsatisfiable requirements detected for package GluonModel [168114fb]:
 GluonModel [168114fb] log:
 ├─GluonModel [168114fb] has no known versions!
 └─restricted to versions * by ColdDSE [6af89522] — no versions left
   └─ColdDSE [6af89522] log:
     ├─possible versions are: 0.1.0 or uninstalled
     └─ColdDSE [6af89522] is fixed to version 0.1.0

This problem can be solved if I install the GluonModel package in advance manually:

] add https://github.com/Bai-Zhan/GluonModel.git

but I hope these dependencies can be installed automatically, since there is likely to be more and more dependencies like this in the future.

How can I fix this problem?

Your Project.toml file lists no dependencies (and your code does not import ColdDSE either.

You need to Pkg.add or Pkg.develop ColdDSE (which will then appear in [deps] of Project.toml.

The Project.toml file of GluonModel lists no dependencies because it does not depend on any other package.

The Project.toml file of ColdDSE lists several dependencies, which includes the GluonModel that I want to automatically install.

GluonModel is not registered so it cannot be resolved as a dependency. The manifest of the other package is not enough when you ]add. Not sure what the best practice is for this case. You might consider a private registry if you regularly work with interdependent non-registered packages.

1 Like

Have you tried with adding GluonModel to the sources section in the ColdSDE Project.toml file? See: Sources Section

The sources section is a new development that wasn’t available when this was discussed two years ago. It can to some extent help with this scenario but is limited in that it’s not resolved recursively, so you can’t link up a tree of unregistered dependencies with it. The most robust solution is still to set up your own registry for the packages which are not registered in General.

2 Likes

Oh whops, I didn’t mean to necrobump. I saw this thread posted on slack recently and blindly assumed it was recent.

1 Like