Julia environments

This page is not specific to PhysiCellModelManager.jl, but using a dedicated environment per project is a Julia best practice that makes your work reproducible and avoids dependency conflicts. If you are new to Julia, read this before setting up a project.

What an environment is

A Julia environment is a pair of files that pin exactly which packages — and which versions — are available:

  • Project.toml — the packages you asked for (e.g. PhysiCellModelManager, Plots).
  • Manifest.toml — the full, resolved dependency tree with exact versions. Regenerated by Julia; you do not edit it by hand.

By default, the Pkg REPL installs into a shared global environment. That works for quick experiments, but it mixes every project's dependencies together. A per-project environment keeps each project self-contained.

Activate an environment

Point Julia at a project folder when you launch it:

julia --project=.

The . is the current directory; pass a path to use a different folder. Once inside, any pkg> add ... installs into that project's Project.toml.

Equivalently, activate from inside the Pkg REPL (press ]):

pkg> activate .
pkg> add PhysiCellModelManager

Run pkg> status to see what is installed in the active environment.

Activate automatically with JULIA_PROJECT

To avoid passing --project every time, set the JULIA_PROJECT environment variable to @.:

export JULIA_PROJECT=@.

The @. tells Julia to search the current directory and its parents for a Project.toml and activate the first one it finds, falling back to the global environment if there is none. Add the line to your shell profile (e.g. ~/.bashrc or ~/.zshenv) to make it the default, so simply running julia from anywhere inside a project folder activates that project's environment.

  1. Create or enter your PhysiCellModelManager.jl project folder.
  2. Launch with julia --project=. so every package you add is recorded there.
  3. Add the packages you need (PhysiCellModelManager, plus analysis packages like Plots).
  4. Commit Project.toml and Manifest.toml to version control. Together they let you — or a collaborator, or an HPC node — reproduce the exact environment with a single pkg> instantiate.
pkg> instantiate    # installs the exact versions recorded in Manifest.toml

Committing these files alongside your inputs and scripts directories (see Best practices) is what makes a PhysiCellModelManager.jl project fully reproducible.

What happens when the package loads

using PhysiCellModelManager looks for PhysiCell/ and data/ directories in the working directory Julia was launched from. If it finds them it attaches to that project and prints the logo and status banner; if it does not, it prints a short hint telling you to run createProject or initializeModelManager. Either way you can attach to a project explicitly at any time:

julia> initializeModelManager("path/to/project")

The banner appears each time the globals change, so it is a reliable signal of which project a session is pointed at.

Learn more

See the Pkg.jl documentation for the complete reference on environments.