Adding a new (yet to be installed) package does not seem to download the package

I was trying to add a new package (custom package) “P” of version 2.0, which is the latest version of the package “P” to my project environment and run into some weird issue (Julia v 1.6, macosx 11.6). The package “P” with version 2.0 depends on another package “D” of version 2.0 (defined in [deps] and [compat] section of the Project.toml file of the package “P”). I had versions 1.0 of both packages “P” and “D” installed and available in my Julia depot. However, versions 2.0 of both packages were not available/installed yet on my computer.

When I tried adding package “P” to my project (I did not specify the version, assuming it will always try to add the latest version of package “P”), It kept adding v1.0 which depends on “D” of v1.0 as well.

Is this the expected behavior of the Pkg.add(“P”) or pkg> add P ? I was assuming “add” command would download the latest version of the package “P” (and whatever versions of deps “D” defined in its Project.toml file). [Custom registry was updated during this experiment, so the latest versions of those packages “P” and “D” were registered.]

Can’t say for certain what’s going on here, especially as I’ve never used custom registries, but could just be that the resolver decided this was the best option as other packages in the environment might be incompatible with D v2.0? I guess you could just do ] add P@2.0 to see what happens.

Thanks for that info. Yeah, ] P@2.0 would work, but the main point of this experiment was to avoid doing that so that a brand new user on a brand new computer (with updated custom registry present in the depot), would simply do add P to get the latest version of the package without having to memorize the version number.

Just one clarification-- there are no additional packages involved. Simply P and D so there can’t be any incompatibility issue.