This page documents common dependency-related problems in afterpython and their solutions. The system uses a dual dependency management strategy with both uv and pixi, which can lead to specific issues around lock file synchronization, version constraints, and platform-specific resolution. For general build errors, see Build Errors. For CI/CD-specific dependency failures, see CI/CD Failures.
The afterpython system manages dependencies through two parallel systems that must remain synchronized:
Diagram: Dual Dependency System and Conflict Points
Sources: pyproject.toml1-74 pixi.toml1-78 uv.lock1-10 pixi.lock1-40
Symptom: Installation fails with version conflict errors related to platformdirs or nodeenv packages.
Root Cause: The mystmd package on PyPI has restrictive version constraints (platformdirs~=4.2.2, nodeenv~=1.9.1) that conflict with other packages requiring newer versions.
Resolution Strategy:
The system employs different strategies depending on the package manager:
| Manager | Strategy | Configuration Location |
|---|---|---|
uv | Override dependencies | [tool.uv] in pyproject.toml |
pixi | Install from conda-forge | [dependencies] in pixi.toml |
For uv users:
The override mechanism in pyproject.toml63-65 relaxes mystmd's constraints:
This override is reflected in uv.lock6-9:
[manifest]
overrides = [
{ name = "nodeenv", specifier = ">=1.9.1" },
{ name = "platformdirs", specifier = ">=4.5.0" },
]
For pixi users:
The system installs mystmd from conda-forge instead of PyPI, as documented in pixi.toml21-23:
Manual Fix:
If you encounter this issue:
uv lock --upgrade-package platformdirs --upgrade-package nodeenvmystmd is in [dependencies] not [pypi-dependencies]Sources: pyproject.toml63-65 pixi.toml18-24 uv.lock6-9
Symptom: After running ap bump, the repository has uncommitted pixi.lock changes, or subsequent pixi commands fail.
Root Cause: The version bump updates pyproject.toml version, which affects the editable installation reference in pixi.lock. The lock file must be regenerated to reflect the new version.
Diagram: Automatic Lock File Update During Version Bump
The ap bump command automatically handles this in src/afterpython/cli/commands/bump.py94-118:
Manual Fix:
If lock file is out of sync:
pixi install to regenerate the lockgit diff pixi.lockgit add pixi.lock && git commit -m "build: update pixi.lock"Sources: src/afterpython/cli/commands/bump.py94-118
Symptom: Dependencies install successfully on one platform but fail on another (e.g., works on Linux but fails on Windows or macOS ARM).
Root Cause: pixi.lock contains platform-specific package resolutions. Different platforms may have different available packages or versions from conda-forge.
Diagram: Platform-Specific Resolution in pixi.lock
The lock file contains separate resolution trees for each platform as seen in pixi.lock9-40 for Linux:
packages:
linux-64:
- conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2
...
osx-64:
- conda: https://conda.anaconda.org/conda-forge/osx-64/bzip2-1.0.8-h500dc9f_8.conda
Resolution:
| Issue Type | Solution |
|---|---|
| Missing package | Check if package is available on conda-forge for target platform |
| Version unavailable | Relax version constraint in pixi.toml or use platform-specific overrides |
| Architecture mismatch | Use PyPI fallback in [pypi-dependencies] if conda package unavailable |
Manual Fix:
pixi installhttps://anaconda.org/conda-forge/<package-name>[pypi-dependencies] which has better cross-platform supportpixi lock --revalidateSources: pixi.toml5 pixi.lock9-174
Symptom: uv.lock and pixi.lock contain different versions of the same package, leading to inconsistent behavior depending on which manager is used.
Root Cause: The two package managers use different dependency resolution algorithms and package sources (PyPI vs conda-forge). Updates to one lock file don't automatically propagate to the other.
Detection Matrix:
| Condition | uv Environment | pixi Environment | Issue Indicator |
|---|---|---|---|
| Package versions match | ✓ Works | ✓ Works | No issue |
| uv newer, pixi older | ✓ Works | ⚠ May fail | Version mismatch warnings |
| pixi newer, uv older | ⚠ May fail | ✓ Works | Import errors, API changes |
| Both outdated | ⚠ May fail | ⚠ May fail | Security vulnerabilities |
Resolution Process:
Diagram: Lock File Synchronization Workflow
Manual Synchronization:
Compare package versions:
Update source configurations to match:
Regenerate both locks:
Test both environments:
Sources: pyproject.toml34-52 pixi.toml27-44
Symptom: Installation fails with errors about missing compilers, system libraries, or build tools.
Root Cause: Some PyPI packages require system-level dependencies for compilation. The uv-only approach lacks these, while pixi includes them via conda-forge.
System Dependency Comparison:
| Dependency Type | uv Environment | pixi Environment |
|---|---|---|
| C compiler | ❌ Must be system-installed | ✓ Provided by conda |
| Node.js | ❌ Must be system-installed | ✓ From pixi.toml24 |
| GitHub CLI | ❌ Must be system-installed | ✓ From pixi.toml24 |
| OpenSSL/SSL libs | ❌ System-dependent | ✓ Versioned in conda |
| ICU (Unicode) | ❌ System-dependent | ✓ From conda-forge |
Resolution:
The pixi environment includes system dependencies like nodejs and gh CLI as shown in pixi.toml18-24:
These appear in the lock file with specific versions for each platform, e.g., pixi.lock14 for Linux:
- conda: https://conda.anaconda.org/conda-forge/linux-64/gh-2.83.1-h76a2195_0.conda
Manual Fix:
For missing compilers/build tools:
apt-get install build-essential or similarFor missing Node.js/system tools:
pixi installFor SSL/crypto errors:
Sources: pixi.toml18-24 pixi.lock14-40
Symptom: uv lock or pixi lock commands take minutes or hang indefinitely.
Root Cause: Complex dependency trees with many optional features can cause resolution algorithms to explore exponential solution spaces. The uv.lock contains ~400 packages with extensive platform-specific wheels.
Performance Characteristics:
| Operation | Expected Time | Slow Threshold | File Reference |
|---|---|---|---|
uv lock | < 30 seconds | > 2 minutes | uv.lock1 (~400 pkgs) |
pixi lock | < 1 minute | > 5 minutes | pixi.lock1 (multi-platform) |
uv sync | < 10 seconds | > 1 minute | N/A |
pixi install | < 30 seconds | > 2 minutes | N/A |
Resolution:
Use cached resolution:
Incremental updates:
Simplify constraints:
>= instead of ~= for more resolution flexibilityClear caches:
Sources: uv.lock1-150 pixi.lock1-40
Symptom: Pre-commit hooks fail with import errors or version conflicts, even though main installation works.
Root Cause: Pre-commit creates isolated virtual environments for each hook, which may resolve dependencies differently than the main environment.
Hook Dependency Flow:
Diagram: Pre-commit Isolated Environment Issues
Resolution:
Update pre-commit environments:
Force re-creation:
Match Python version:
Verify pre-commit uses the same Python as your main environment by checking .pre-commit-config.yaml language versions.
For persistent issues: Run tools directly instead of through pre-commit:
Sources: pyproject.toml49-50
Use these commands to diagnose dependency issues:
| Command | Purpose | Output Interpretation |
|---|---|---|
uv pip list | Show installed packages in uv environment | Compare versions with uv.lock |
pixi list | Show installed packages in pixi environment | Compare versions with pixi.lock |
uv tree <package> | Show dependency tree for package | Identify constraint conflicts |
uv pip check | Verify no broken dependencies | Resolves to fix suggestions |
pixi info | Show pixi environment information | Verify platform and Python version |
diff <(uv pip list) <(pixi list) | Compare environments | Identify version divergence |
ap sync | Check configuration sync | Verify metadata consistency |
Sources: pyproject.toml34-52 pixi.toml27-44
To avoid dependency issues:
Keep sources synchronized:
Regenerate locks together:
Test both environments in CI: The CI workflow automatically detects and tests both as shown in .github/workflows/ci.yml
Use version ranges, not pins:
>=X.Y.Z over ==X.Y.ZDocument special cases:
Regular updates:
Commit lock files: Both uv.lock and pixi.lock are tracked in git per .gitignore95-105 to ensure reproducibility
Sources: pyproject.toml34-65 pixi.toml21-44 .gitignore95-105
Refresh this wiki