Julia Environment Management with Isolated Binaries

Creating completely isolated Julia environments with project-local binaries and packages

technical-notes
#julia #environment #reproducibility

Environment

  1. Fedora Linux 42
  2. JuliaUp (for managing multiple Julia installations)
  3. Julia 1.11.7

Setup Isolated Julia Environment

1. Download Binary to Project

Download and extract Julia binary to project folder:

wget https://julialang-s3.julialang.org/bin/linux/x64/1.11/julia-1.11.7-linux-x86_64.tar.gz && \
mkdir -p .julia && tar -xzf julia-1.11.7-linux-x86_64.tar.gz -C .julia --strip-components=1 && \
rm julia-1.11.7-linux-x86_64.tar.gz

Important: Add .julia to .gitignore (see Package Storage Location for details)

Register the local binary with juliaup (example for “foo” project):

juliaup link foo .julia/bin/julia

Verify:

juliaup list
# Should show: foo -> .julia/bin/julia

3. Create Project Environment

Start Julia with the isolated binary:

julia +foo

Activate project environment:

] activate .

Or programmatically:

using Pkg
Pkg.activate(".")

This creates Project.toml and Manifest.toml in your project root.

4. Install Packages

With environment activated:

] add DataFrames CSV Plots

Using the Environment

Always specify both the binary channel and project:

julia +foo --project

Or set alias:

alias julia-project='julia +foo --project'

Package Storage Location

Note: Packages are stored in ~/.julia/packages/ by default, not in the project .julia/ folder. The project .julia/ contains only the Julia binary. Project.toml and Manifest.toml are in the project root.

Your .gitignore only needs:

.julia

For completely isolated package storage (rarely needed):

export JULIA_DEPOT_PATH="$(pwd)/.julia"
julia +foo --project

Project Structure

my-project/
├── .julia/             
│   ├── bin/
│   ├── lib/
│   └── share/
├── Project.toml         
├── Manifest.toml        
└── .gitignore           

Reproducing Environment

On new machine:

  1. Clone repository
  2. Download same Julia binary version
  3. Link with juliaup
  4. Instantiate packages:
julia +project-name --project -e 'using Pkg; Pkg.instantiate()'

References

  1. Julia Downloads
  2. JuliaUp Documentation
  3. Pkg.jl Documentation