Conda packages

Last updated on 2025-06-15 | Edit this page

Estimated time: 45 minutes

Overview

Questions

  • What is a conda package?

Objectives

  • Learn about conda package structure

Conda packages


In a previous episode we learned that Pixi can control conda packages, but what is a conda package? Conda packages (.conda files) are language agnostic file archives that contain built code distributions. This is quite powerful, as it allows for arbitrary code to be built for any target platform and then packaged with its metadata. When a conda package is downloaded and then unpacked with a conda package management tool (e.g. Pixi, conda, mamba) the only thing that needs to be done to “install” that package is just copy the package’s file directory tree to the base of the environment’s directory tree. Package contents are also simple; they can only contain files and symbolic links.

Exploring package structure

To better understand conda packages and the environment directory tree structure they exist in, let’s make a new Pixi project and look at the project environment directory tree structure.

BASH

pixi init ~/pixi-lesson/dir-structure
cd ~/pixi-lesson/dir-structure

OUTPUT

✔ Created /home/<username>/pixi-lesson/dir-structure/pixi.toml

To help visualize this on the command line we’ll use the tree program (Linux and macOS), which we’ll install as a global utility from conda-forge using pixi global.

At the moment our Pixi project manifest is empty

TOML

[workspace]
channels = ["conda-forge"]
name = "dir-structure"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]

and so is our directory tree

Let’s add a dependency to our project to change that

BASH

pixi add python

OUTPUT

✔ Added python >=3.13.3,<3.14

which now gives us an update Pixi manifest

TOML

[workspace]
channels = ["conda-forge"]
name = "dir-structure"
platforms = ["linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = ">=3.13.3,<3.14"

and the start of a directory tree with the .pixi/ directory

Let’s now use tree to look at the directory structure of the Pixi project starting at the same directory where the pixi.toml manifest file is.

We see that the default environment that Pixi created has the standard directory tree layout for operating systems following the Filesystem Hierarchy Standard (FHS) (e.g. Unix machines)

  • bin: for binary executables
  • include: for include files (e.g. header files in C/C++)
  • lib: for binary libraries
  • share: for files and data that other libraries or applications might need from the installed programs

as well as some less common ones related to system administration

  • man: for manual pages
  • sbin: for system binaries
  • ssl: for SSL (Secure Sockets Layer) certificates to provide secure encryption when connecting to websites

as well as other directories that are specific to conda packages

  • conda-meta: for metadata for all installed conda packages
  • x86_64-conda_cos6-linux-gnu and x86_64-conda-linux-gnu: for platform specific tools (like linkers) — this will vary depending on your operating system

How did this directory tree get here? It is a result of all the files that were in the conda packages we downloaded and installed as dependencies of Python.

We can download an individual conda package manually using a tool like curl. Let’s download the particular python conda package from where it is hosted on conda-forge’s Anaconda.org organization

.conda is probably not a file extension that you’ve seen before, but you are probably very familiar with the actual archive compression format. .conda files are .zip files that have been renamed, but we can use the same utilities to interact with them as we would with .zip files.

We see that the .conda archive contained package format metadata (metadata.json) as well as two other tar archives compressed with the Zstandard compression algorithm (.tar.zst). We can uncompress them manually with tar

BASH

cd output
mkdir -p pkg
tar --zstd -xvf pkg-python-*.tar.zst --directory pkg

and then look at the uncompressed directory tree with tree

So we can see that the directory structure of the conda package

is reflected in the directory tree of the Pixi environment with the package installed

Discussion

Hopefully this seems straightforward and unmagical — because it is! Conda package structure is simple and easy to understand because it builds off of basic file system structures and doesn’t try to invent new systems. It is important to demystify what is happening with the directory tree structure though so that we keep in our minds that our tools are just manipulating files.

Exploring conda-forge

As of 2025 conda-forge has over 28,500 packages on it. Go to the conda-forge package list website (https://conda-forge.org/packages/) and try to find three packages that you use in your research, and three packages from your scientific field that are more niche.

Research packages:

Niche particle physics packages:

Key Points

  • Conda packages are specially named .zip files that contain files and symbolic links structured in a directory tree.