Py-Rattler

raw JSON →
0.23.2 verified Fri May 01 auth: no python

A blazing fast Python library to work with the conda ecosystem, built on top of the Rust rattler libraries. Current version 0.23.2. Release cadence is active, with frequent updates.

pip install py-rattler
error ModuleNotFoundError: No module named 'rattler_conda'
cause Outdated import path from version <0.20
fix
Change import to from rattler import ...
error AttributeError: module 'rattler' has no attribute 'solve'
cause Attempted to import 'solve' instead of 'solver'
fix
Use from rattler import solver
error rattler.gateway.GatewayError: failed to load repodata
cause Network issues or incorrect channel URL
fix
Verify channel URL is valid and you have internet access. Use explicit channel like Channel('conda-forge')
breaking In v0.20, the main module was renamed from rattler_conda to rattler. Import paths changed.
fix Use `from rattler import ...` instead of `from rattler_conda import ...`
gotcha The solver module is named 'solver', not 'solve'. Many first-timers import the wrong name.
fix Use `from rattler import solver`
gotcha Gateway constructor may need a custom prefix or channels. By default it uses the current conda environment.
fix Explicitly pass channels or prefix when creating Gateway if needed.

Basic example: query conda-forge for package information.

import os
from rattler import Gateway, Channel, PrefixRecord

# Initialize gateway with custom channels
gateway = Gateway()
# Query some packages
package_names = ["python", "numpy"]
channel = Channel("conda-forge")
for name in package_names:
    pkg_info = gateway.query(channel, name)
    print(f"Latest version of {name}: {pkg_info[0].version if pkg_info else 'not found'}")