Skip to main content
A lock file is the protector of the environments, and Pixi is the key to unlock it.
The lock file is crucial for creating reproducible environments. It captures the exact state of your environment, ensuring everyone working on your project uses identical package versions.

What is a Lock File?

A lock file locks the environment in a specific state. In Pixi, the pixi.lock file contains two main definitions:

1. Environment Definitions

Lists all packages for each environment and platform:

2. Package Definitions

Complete metadata for each package:

Why Use a Lock File?

Pixi uses lock files for several critical reasons: Save Environment State
  • Captures complete environment without copying all files
  • Enables quick environment recreation
  • Much smaller than container images
Ensure Consistency
  • Guarantees workspace configuration matches environment
  • Prevents “works on my machine” problems
  • Aligns with your pixi.toml manifest
Enable Collaboration
  • Colleagues get identical environments
  • No dependency resolution conflicts
  • Reduces onboarding friction
Support Reproducibility
  • Run the same environment across machines
  • Critical for CI/CD systems
  • Easy rollback to working states
Using lock files makes tools like Docker less necessary for reproducibility.

When is a Lock File Generated?

The lock file is generated during the solve step of package installation: These commands automatically update the lock file when dependencies change:
  • pixi install
  • pixi run
  • pixi shell
  • pixi shell-hook
  • pixi tree
  • pixi list
  • pixi add
  • pixi remove
The lock file is always kept in sync with your pixi.toml or pyproject.toml manifest.

How to Use the Lock File

Do not edit the lock file manually! It is a machine-only file.
The pixi.lock is human-readable, making it easy to track changes in version control:

Lock File Options

All environment commands support lock file usage options: Frozen Mode
Locked Mode
--frozen is useful in CI/CD to ensure exact reproducibility. --locked fails fast if lock file is out of sync.

Syncing Lock File with Manifest

The lock file must match the complete manifest configuration: When you change pixi.toml, Pixi automatically updates the lock file:

Lock File Satisfiability

Pixi checks if the lock file is “satisfiable” - meaning the manifest, lock file, and environment are in sync.

Satisfiability Checks

  • All environments in manifest exist in lock file
  • All channels in manifest exist in lock file
  • All packages in manifest are in lock file with compatible versions
  • Package versions match manifest requirements (uses conda matchspecs)
  • For PyPI dependencies, all Python conda packages have purls fields
  • All hashes for editable PyPI packages are correct
  • Only one entry per package exists
If the lock file is not satisfiable, Pixi automatically generates a new one.

Lock File Version

The lock file includes a version for compatibility:
Pixi is backward compatible but not forward compatible:
  • ✅ Newer Pixi can use older lock files
  • ❌ Older Pixi cannot use newer lock files
Always use Pixi versions that support your lock file version.

Lock File Size

Lock files can grow large with many packages, but:
  1. Pixi optimizes for minimal size
  2. Lock files are always smaller than Docker images
  3. Downloading a small lock file is faster than downloading wrong packages
  4. The size ensures complete reproducibility
If lock file size is a concern:
  • It’s still smaller than equivalent container images
  • Download time is minimal compared to package downloads
  • The completeness prevents costly dependency resolution errors
  • Consider it a small price for guaranteed reproducibility

When You Don’t Need a Lock File

You might skip lock files if:
  • You don’t need reproducible environments
  • You’re always building from scratch
  • You’re experimenting with package versions
But consider these benefits: CI Systems
The lock file ensures CI uses the exact same packages you tested locally. Team Collaboration
No more “Did you try version X?” or “Works on my machine.” Rollback Safety
Instantly return to a known-good state.

Removing the Lock File

You can delete the lock file to force a fresh solve:
Removing the lock file updates all packages to their latest compatible versions. You may lose the exact working state.

Best Practices

Always Commit Lock Files
Use Frozen in CI
Review Lock File Changes
Force Fresh Solve

Example: Multi-Platform Lock File

A lock file for a multi-platform project:
Each platform gets its exact package build, ensuring consistency everywhere.