Skip to main content

Quick Start Guide

This guide will walk you through creating your first Pixi workspace, adding dependencies, and running tasks. You’ll have a working project in under 5 minutes!
Make sure you have installed Pixi before continuing.

Create Your First Workspace

A Pixi workspace is a directory with a pixi.toml manifest file that defines your project’s dependencies, tasks, and environments.
1

Initialize a new workspace

Create a new workspace called my_workspace:
This creates a new directory with the following structure:
2

Explore the manifest

The pixi.toml file is your workspace’s manifest:
Install the Even Better TOML extension in VS Code for autocompletion based on Pixi’s JSON schema!

Add Dependencies

Let’s add some Python packages to the workspace.
1

Add Python and NumPy

This command:
  • Adds dependencies to pixi.toml
  • Solves all dependencies
  • Creates/updates pixi.lock with exact versions
  • Installs packages into the environment at .pixi/envs/default
Your pixi.toml now includes:
2

Add more packages

Add pytest for testing:
You can also specify exact versions:

Understanding the Lock File

Pixi automatically created a pixi.lock file containing exact versions of all dependencies:
This ensures reproducible environments across machines and over time.

Run Commands in Your Environment

Now let’s use the packages we installed.
1

Run a command directly

Use pixi run to execute commands in the environment:
Try using NumPy:
2

Use the shell

Start an interactive shell in the environment:
Your prompt will change to indicate you’re in the Pixi environment. Now you can run commands directly:
Type exit to leave the shell.

Create and Run Tasks

Tasks are reusable commands defined in your manifest. They’re perfect for common operations like testing, building, or running your application.
1

Create a Python script

Create a file called hello.py:
2

Add a task to run the script

This adds the following to your pixi.toml:
3

Run the task

Output:

Add More Complex Tasks

Tasks can have dependencies and arguments for more complex workflows.
1

Add a test task

Create a simple test file test_hello.py:
Add a test task:
2

Create a task with dependencies

Add this to your pixi.toml manually:
Now running pixi run run-all will execute all three tasks in order:

Working with PyPI Packages

Pixi seamlessly integrates conda packages with PyPI packages.
1

Add a PyPI package

Use the --pypi flag to install from PyPI:
This adds to pixi.toml:
2

Use the PyPI package

Pixi ensures there are no conflicts between conda and PyPI packages.

Complete Example Workflow

Here’s a complete example putting it all together:
Run the complete pipeline:

Next Steps

Congratulations! You’ve learned the basics of Pixi. Here’s what to explore next:

Multiple Environments

Learn how to manage development, testing, and production environments

Advanced Tasks

Discover powerful task features like arguments and templates

Global Tools

Install CLI tools system-wide with Pixi

Multi-Platform Support

Configure projects for Linux, macOS, and Windows

Common Workflows

Starting an Existing Project

If you clone a repository with a pixi.toml:

Adding Platform-Specific Dependencies

Updating Dependencies

Cleaning Up

Tips for Success

Commit pixi.lock: Always commit your lock file to version control to ensure reproducible environments.
Use pixi.toml schema: Configure your IDE to use the JSON schema for autocompletion and validation.
Global tools: Use pixi global install for CLI tools you want available everywhere, not just in projects.
Don’t mix conda and pip: Always use pixi add --pypi for PyPI packages instead of running pip install directly. This ensures Pixi can manage dependencies properly.