Missing dependencies error in new package

As I develop a new package (initialized using the instructions here PkgTemplates.jl, I receive these kinds of warnings:

julia> using PolarDemixing
[ Info: Recompiling stale cache file /Users/mpf/.julia/compiled/v1.2/PolarDemixing/v6QzV.ji for PolarDemixing [e00659c4-439f-45b2-9919-f3776aaaadb4]
┌ Warning: Package PolarDemixing does not have Random in its dependencies:
│ - If you have PolarDemixing checked out for development and have
│   added Random as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with PolarDemixing
└ Loading Random into PolarDemixing from project dependency, future warnings for PolarDemixing are suppressed.

I can suppress this error by editing .julia/environments/v1.2/Manifest.toml and adding deps = ["LinearAlgebra", "Random"] under the package name. This is probably not the intended way to add dependencies.

What’s the right approach?

Enter pkg mode ], add Random (project has to be active)

3 Likes

Hand editing Manifest.toml is not recommended (the edits are anyway overridden next time you add a dependency etc.

These Notes on the Julia language may be helpful to get started with understanding packages.

2 Likes

How to you make a project “active”?

You active with “active .” in pkg mode in the directory of the package.

2 Likes

Now I understand the right workflow: activate then add. Thanks to all for pointing the way!