Skip to main content
The pixi.lock file is a lock file that records the exact versions of all packages installed in your environments. It ensures reproducible installations across different machines and over time.

Overview

The lock file is automatically generated by pixi and should be committed to version control. It contains:
  • Exact package versions and builds
  • Package URLs and hashes
  • Dependency relationships
  • Platform-specific packages
  • Environment configurations
The lock file format is considered internal and may change between pixi versions. Do not manually edit the lock file.

Lock File Location

The lock file is always named pixi.lock and placed in the workspace root, next to pixi.toml or pyproject.toml.

When is it Generated?

The lock file is created or updated when:
  • Running pixi install
  • Running pixi add or pixi remove
  • Running pixi run (if lock file is outdated)
  • Running pixi update
  • Manually running pixi lock
The lock file is not updated when:
  • Using --frozen flag
  • Using --locked flag (fails instead if outdated)
  • Lock file is already up-to-date with manifest

File Format

The lock file uses a custom TOML-based format optimized for readability and merge-friendliness.

Basic Structure

Metadata Section

Contains:
  • channels - Channels used during solve
  • platforms - Target platforms
  • content_hash - Hash of manifest content for validation

Environments Section

Maps environment names to their feature lists.

Package Entries

Each package is recorded with complete information:
Key fields:
  • name - Package name
  • version - Exact version
  • build - Build string
  • build_number - Build number
  • subdir - Platform (linux-64, osx-64, etc.)
  • url - Download URL
  • sha256 / md5 - Checksums for verification
  • size - Package size in bytes
  • timestamp - Build timestamp
  • depends - Runtime dependencies

PyPI Packages

PyPI packages are recorded separately:

Version Control

Should I Commit pixi.lock?

Yes! Always commit pixi.lock to version control.
  • Reproducibility: Ensures everyone gets the same package versions
  • Determinism: Builds are consistent across environments
  • History: Track dependency changes over time
  • Debugging: Know exactly what versions were used
  • CI/CD: Reliable automated builds
No! Do not add pixi.lock to .gitignore.Only ignore environment directories:

Handling Merge Conflicts

If you get a merge conflict in pixi.lock:
  1. Accept either version:
  2. Regenerate lock file:
  3. Commit resolved lock file:
The lock file format is designed to minimize merge conflicts, but when they occur, regenerating is the safest approach.

Lock File Commands

Update lock file

Use existing lock file

Validate lock file

Lock File vs Manifest

Understanding the difference:

Reproducibility

The lock file provides reproducibility through:
  1. Exact versions: No version ranges, specific builds
  2. Checksums: SHA256/MD5 hashes verify package integrity
  3. URLs: Direct download links (with fallbacks)
  4. Dependencies: Full dependency tree recorded
  5. Platforms: Platform-specific packages for each target

Example: Reproducible CI

Lock File Optimization

Pixi optimizes the lock file for:
  • Merge-friendliness: Deterministic ordering
  • Readability: Human-readable TOML
  • Size: Compressed format for large dependency trees
  • Performance: Fast parsing and lookup

Troubleshooting

Error: “Lock file is out of date with the manifest”Solution:
Problem: Git merge conflict in pixi.lockSolution:
Problem: Lock file is very largeCause: Large dependency trees, many platformsSolution:
  • Reduce number of platforms if not needed
  • Consider splitting environments
  • This is normal for complex projects
Error: “Failed to parse lock file”Solution: