pixi clean cache --exec.
Usage
pixi x
Arguments
The executable to run, followed by any arguments.If no package specs are provided with
--spec, pixi will attempt to guess the package name from the command.Options
Matchspecs of packages to install.If this is not provided, the package is guessed from the command name.Can be specified multiple times.
Matchspecs of packages to install, while also guessing a package from the command.This option allows you to specify additional dependencies alongside the auto-guessed package.Cannot be used together with
--spec.The channels to consider as a name or a URL. Multiple channels can be specified by using this field multiple times.When specifying a channel, it is common that the selected channel also depends on the
conda-forge channel.By default, if no channel is provided, conda-forge is used.The platform to create the environment for. Defaults to the current platform.
If specified, a new environment is always created even if one already exists.
Before executing the command, list packages in the environment.Specify
--list=some_regex to filter the shown packages.Disable modification of the PS1 prompt to indicate the temporary environment.
Examples
Run a command with auto-guessed package
python --version.
Run a command with specific package versions
Run a command with multiple packages
Run with additional dependencies
jupyter (guessed from the command) and polars (specified with --with).
Use a specific channel
Force reinstall
List packages before execution
Cross-platform execution
How It Works
- Package Resolution: If
--specis not provided, pixi guesses the package name from the command - Environment Creation: Pixi creates (or reuses) a cached environment with the required packages
- Execution: The command runs in the activated environment
- Caching: The environment is cached for future use
Temporary environments are stored in the pixi cache directory and are reused across invocations with the same dependencies.
Environment Naming
Temporary environments are named based on:- The command name
- The package specifications
- The channels used
- The target platform
Cleaning Up
Remove all temporary exec environments:Use Cases
One-off Commands
Testing Different Versions
Quick Scripts
CI/CD
Package Guessing
When you don’t specify--spec, pixi attempts to guess the package name:
Differences from pixi run
| Feature | pixi exec | pixi run |
|---|---|---|
| Scope | Temporary environment | Project environment |
| Package source | Specified via CLI | From pixi.toml |
| Caching | Automatic | N/A |
| Use case | One-off commands | Project tasks |
Environment Variables
The temporary environment sets:PIXI_ENVIRONMENT_NAME:temp:<package-names>PS1or_PIXI_PROMPT: Modified prompt (unless--no-modify-ps1)- All standard conda environment variables