Julia | How to add a package to a specific project
As usual, when creating project codebases, it's recommended to maintain a controlled environment for the dependencies of the project so that collaborators can reliably reproduce the same results from the codebase. This usually means activating specific environments for package managers to use.
To do so in Julia:
Change working directory to the project.
Start the Julia REPL by typing
julia
into the command prompt.Press the
]
key; this should change mode to the package manager, with a prompt that looks like this:(@v1.6) pkg>
Activate the current working directory as the environment (the period indicates the current directory):
(@v1.6) pkg> activate .
Activating environment at `your/project/path/Project.toml`
As long as the environment is active, any time you add a package, the package dependency will be added to the current project.
Resources: