Skip to main content
The pixi remove command removes dependencies from your workspace manifest and updates the lock file.

Usage

pixi remove [OPTIONS] <SPEC>...

Arguments

SPEC
string
required
The dependency to remove. Can be:
  • Package name: numpy
  • Multiple packages: numpy pandas scipy
Multiple packages can be specified.

Options

Dependency Type

--pypi
boolean
default:"false"
Remove a PyPI dependency instead of conda. Conflicts with --host and --build.
pixi remove --pypi requests
pixi remove --pypi flask boto3
--host
boolean
default:"false"
Remove a host dependency. Conflicts with --build and --pypi.
--build
boolean
default:"false"
Remove a build dependency. Conflicts with --host and --pypi.
pixi remove cmake --build
pixi remove python --host

Platform-Specific

--platform
string
Remove dependency for specific platform(s). Can be specified multiple times.Short flag: -p
pixi remove cuda --platform linux-64
pixi remove numpy --platform linux-64 --platform osx-arm64

Feature-Specific

--feature
string
default:"default"
Remove dependency from a specific feature.Short flag: -f
pixi remove pytest --feature test
pixi remove cuda --feature gpu

Update Options

Skip Installation

--no-install
boolean
default:"false"
Don’t reinstall the environment, only update the lock file.
pixi remove numpy --no-install

Lock File Usage

--frozen
boolean
default:"false"
Don’t update the lock file.Env: PIXI_FROZEN
--locked
boolean
default:"false"
Require lock file to be up-to-date.Env: PIXI_LOCKED
pixi remove numpy --frozen
pixi remove pandas --locked

Examples

Remove Single Package

pixi remove numpy
Before:
[dependencies]
python = "3.11.*"
numpy = ">=1.26.0,<2"
pandas = ">=2.0.0,<3"
After:
[dependencies]
python = "3.11.*"
pandas = ">=2.0.0,<3"

Remove Multiple Packages

pixi remove numpy pandas scipy

Remove PyPI Package

pixi remove --pypi requests
Before:
[pypi-dependencies]
requests = "*"
flask = ">=2.0.0"
After:
[pypi-dependencies]
flask = ">=2.0.0"

Remove from PyProject.toml

For pyproject.toml manifests, pixi remove --pypi removes from: Default feature: project.dependencies
pixi remove --pypi boto3
Before:
[project]
dependencies = [
  "boto3",
  "requests",
]
After:
[project]
dependencies = [
  "requests",
]
Named feature: dependency-groups or tool.pixi.pypi-dependencies
pixi remove --pypi boto3 --feature aws
Before:
[dependency-groups]
aws = [
  "boto3",
  "s3fs",
]
After:
[dependency-groups]
aws = [
  "s3fs",
]

Remove Platform-Specific Package

pixi remove cuda --platform linux-64
Before:
[target.linux-64.dependencies]
cuda = ">=12.0.0,<13"
numpy = ">=1.26.0,<2"

[dependencies]
python = "3.11.*"
After:
[target.linux-64.dependencies]
numpy = ">=1.26.0,<2"

[dependencies]
python = "3.11.*"

Remove from Feature

pixi remove pytest pytest-cov --feature test
Before:
[feature.test.dependencies]
pytest = ">=8.0.0,<9"
pytest-cov = ">=4.0.0,<5"
pytest-mock = "*"
After:
[feature.test.dependencies]
pytest-mock = "*"

Remove Build Dependency

pixi remove cmake --build
Before:
[build-dependencies]
cmake = ">=3.20"
make = "*"
After:
[build-dependencies]
make = "*"

Combining Options

Platform + Feature

pixi remove cuda --platform linux-64 --feature gpu
Removes cuda from the gpu feature on linux-64 platform only.

Multiple Platforms

pixi remove numpy --platform linux-64 --platform osx-arm64
Removes numpy from both specified platforms.

PyPI + Feature

pixi remove --pypi pytest --feature test
Removes PyPI pytest from the test feature.

Global Options

--manifest-path
string
Path to pixi.toml, pyproject.toml, or workspace directory.Short flag: -m
pixi remove numpy --manifest-path /path/to/project

Behavior Details

Dependency Detection

Pixi automatically detects where the dependency is defined:
  1. Default dependencies ([dependencies])
  2. Platform-specific dependencies ([target.<platform>.dependencies])
  3. Feature dependencies ([feature.<name>.dependencies])
  4. PyPI dependencies ([pypi-dependencies])
  5. Build/host dependencies

Removing Unused Dependencies

Removing a package doesn’t remove its dependencies. Use pixi update to clean up:
pixi remove numpy
pixi update  # Removes numpy's dependencies if no longer needed

Lock File Update

By default, pixi remove:
  1. Removes package from manifest
  2. Updates lock file
  3. Reinstalls environment
Use --no-install to skip reinstallation:
pixi remove numpy --no-install
pixi install  # Reinstall later

Exit Status

  • 0: Success
  • 1: Package not found in specified location
  • 1: Lock file update failed
  • 1: Installation failed

Troubleshooting

Package Not Found

Error: package 'numpy' not found in dependencies Solutions:
  1. Check if package exists:
pixi list | grep numpy
  1. Check feature/platform:
# Package in feature
pixi remove numpy --feature ml

# Package in platform
pixi remove numpy --platform linux-64
  1. Check if it’s a PyPI package:
pixi remove --pypi numpy

Dependency Still Required

Warning: Other packages may still depend on the removed package. Solution: Check dependencies:
pixi tree | grep numpy
The package will remain in the lock file if other packages need it.

Lock File Out of Sync

Error: lock file is out of sync Solution:
# Update lock file first
pixi install

# Then remove
pixi remove numpy

Removing from Wrong Location

If removing doesn’t work, the package might be in:
  • Different feature: Try --feature <name>
  • Different platform: Try --platform <platform>
  • PyPI section: Try --pypi
  • Build section: Try --build
Inspect manifest to find exact location:
cat pixi.toml | grep -A 5 numpy

Common Workflows

Clean Up Test Dependencies

pixi remove pytest pytest-cov pytest-mock --feature test

Remove Platform-Specific CUDA

pixi remove cuda cudatoolkit --platform linux-64

Remove All PyPI Dev Tools

pixi remove --pypi black flake8 mypy --feature dev

Switch from Conda to PyPI Package

# Remove conda version
pixi remove numpy

# Add PyPI version
pixi add --pypi numpy

See Also