I am currently developing a package, we can call it A, that depends on a second package B, which is also under development.
In package A’s environment I ran ]dev B to add B as a dependency of A. After that B is listed in the Project.toml file of package A.
I switched to the standard environment, where I wanted to use package A, so I ran ] dev A without problems. But when I tried using A, I got the error
“LoadError: ArgumentError: Package A does not have B in its dependencies:”
I then tried to run ] resolve, ] instantiate, ] update on both packages and also ] dev B again in package A’s environment. using A also does not work on package A’s environment.
What am I doing wrong? Is it because of the indirect dependency on a dev package?
Try to create a minimum example that exhibits the problem and show some more detail on exactly what you did. e.g something starting with (in Julia pkg mode):
generate A
generate B
activate ./A
dev ./B
Hereafter, insert the line using B immediately before the line greet() = println("Hello World!") in the file ./A/src/A.jl.
Hereafter in Julia mode execute:
import Pkg
Pkg.activate()
Pkg.develop(path="./A")
using A
I had package B, which is working fine.
For package A, I created it with PkgTemplates (package B was also originally created like this).
using PkgTemplates
t = Template(;
user="MyName",
authors=["My Name"],
plugins=[
License(name="MIT"),
Git(),
GitHubActions(),
],
)
t("A")
In the file A.jl I included the line using B
Then, in Julia Pkg mode, I ran
activate A
dev B
Which ran successfully and added package B to its Project.toml file. Lastly I tried in the REPL using A
which returned the error.
I then tried what I described, like resolve, instantiate, using the full path of the packages.
One thing I just noticed is that B’s Project.toml file has the fields ‘name’, ‘uuid’, ‘authors’ and ‘version’ in the beginning of the file, before the dependencies. These are missing in A’s Project.toml file.
I got it to work.
I thought I was working on .julia/dev, but now I noticed that my working directory was actually .julia/dev/A and there was a folder called A inside it with a Project.toml and Manifest.toml files. For some reason the dependencies were added to these files, but not to the correct ones. So when I tried using package A, there were no dependencies listed.
Anyway, I am still confused how exactly this happened, but it is working.
Thanks a lot for the help. Really appreciate it!