Skip to content

bug(pypi): unexpected pixi lock behavior with tool.uv.sources path dependencies #4573

Closed

Description

@eightysteele

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

https://github.com/eightysteele/repros/tree/main/pixi/source-dependencies

# pixi lock in research keeps changing
~/repros$ cd pixi/source-dependencies/research/
~/repros/pixi/source-dependencies/research$ pixi lock
✔ Updated lock-file
~/repros/pixi/source-dependencies/research$ pixi lock
✔ Updated lock-file
~/repros/pixi/source-dependencies/research$ pixi lock
✔ Updated lock-file

# pixi lock in modules/c keeps changing
~/repros/pixi/source-dependencies/research$ cd ../modules/c
~/repros/pixi/source-dependencies/modules/c$ pixi lock
✔ Updated lock-file
~/repros/pixi/source-dependencies/modules/c$ pixi lock
✔ Updated lock-file
~/repros/pixi/source-dependencies/modules/c$ pixi lock
✔ Updated lock-file

# pixi lock works as expected in modules/{a,b}
~/repros/pixi/source-dependencies/modules/c$ cd ../a
~/repros/pixi/source-dependencies/modules/a$ pixi lock
✔ Lock-file was already up-to-date
~/repros/pixi/source-dependencies/modules/a$ pixi lock
✔ Lock-file was already up-to-date

~/repros/pixi/source-dependencies/modules/a$ cd ../b
~/repros/pixi/source-dependencies/modules/b$ pixi lock
✔ Lock-file was already up-to-date
~/repros/pixi/source-dependencies/modules/b$ pixi lock
✔ Lock-file was already up-to-date

# pixi lock works as expected in modules/b/cpp
~/repros/pixi/source-dependencies/modules/b$ cd cpp/
~/repros/pixi/source-dependencies/modules/b/cpp$ pixi lock
✔ Lock-file was already up-to-date
~/repros/pixi/source-dependencies/modules/b/cpp$ pixi lock
✔ Lock-file was already up-to-date

Issue description

In the following repro calling pixi lock multiple times in research and modules/c keeps updating the lock file:

https://github.com/eightysteele/repros/tree/main/pixi/source-dependencies

More context in the Discord thread with @tdejager:

https://discord.com/channels/1082332781146800168/1415753479489720434

Expected behavior

I expected pixi lock to update the lock file and then be up-to-date on subsequent pixi lock calls.

Activity

  1. added
    bug
    on Sep 11, 2025
  2. changed the title [-]Unexpected pixi lock behavior with tool.uv.sources path dependencies[/-] [+]bug(pypi): unexpected pixi lock behavior with tool.uv.sources path dependencies[/+] on Sep 12, 2025
  3. added theissue type on Sep 12, 2025
  4. eightysteele commented on Oct 4, 2025

    @eightysteele
    Author

    @tdejager @lucascolley potentially related observation: is it expected that requires_dist contains the absolute (vs. relative) path to the frogrocket-lo module?

    - pypi: ./
      name: frogrocket-slam
      version: 0.1.1.dev131+62c95a092
      sha256: b201205d40e56122b5e9a49972a57af4f77e01a3d533b93ea518afdce5d0741b
      requires_dist:
      - frogrocket-lo @ file:///home/aaron/lab/modules/lo
      - jax>=0.5.0
      - numpy>=2,<3.0.0
      - pyyaml>=6.0.2,<7
      - warp-lang>=1.7.1,<1.9
      requires_python: '>=3.9,<3.13'
      editable: true

    asking because this has been causing lockfile conflicts/updates on the team (since the path changes when pixi lock is run on other machines) and i thought it might be related to the issue we're seeing here.

  5. tdejager commented on Oct 4, 2025

    @tdejager
    Contributor

    Oh man this one totally fell off my radar. Let me take a look next week. Sorry about that

  6. tdejager commented on Oct 4, 2025

    @tdejager
    Contributor

    Might be that if we use sources instead of a directly specified PyPI dependency this causes an absolute path. Might be a good lead indeed

  7. eightysteele commented on Oct 5, 2025

    @eightysteele
    Author

    No worries @tdejager! I did some additional looking and I think [tool.uv.sources] might be implicated.

  8. eightysteele commented on Oct 7, 2025

    @eightysteele
    Author

    @tdejager any inspiration? i'm happy to help make a contribution here if you wanted to point me in the right direction. :)

  9. tdejager commented on Oct 8, 2025

    @tdejager
    Contributor

    Yeah you are right in the hunch that we need to solve the absolute path problem first.

    I improved the error message a bit and running on your example:

    DEBUG pixi_config: Loading config from /etc/pixi/config.toml
    DEBUG pixi_config: Loading config from /Users/tdejager/Library/Application Support/pixi/config.toml
    DEBUG pixi_config: Loading config from /Users/tdejager/.pixi/config.toml
    DEBUG pixi_config: Loaded config from: /Users/tdejager/.pixi/config.toml
    DEBUG pixi_config: Loading config from /private/tmp/repros/pixi/source-dependencies/research/.pixi/config.toml
    DEBUG pixi_config: Failed to load local config: /private/tmp/repros/pixi/source-dependencies/research/.pixi/config.toml (error: no file was found at /private/tmp/repros/pixi/source-dependencies/research/.pixi/config.toml)
     WARN rattler_networking::authentication_storage::storage: error reading netrc file from /Users/tdejager/.netrc: could not parse .netc file: Illegal format in 4:11 token: region
     WARN rattler_networking::authentication_storage::storage: error reading netrc file from /Users/tdejager/.netrc: could not parse .netc file: Illegal format in 4:11 token: region
     INFO pixi_core::lock_file::outdated: the dependencies of environment 'default' for platform linux-64 are out of date because failed to convert between pep508 and uv types: expected an (.whl or sdist) but found: '/private/tmp/repros/pixi/source-dependencies/modules/b'

    Note the last line, so I think we need to make sure that these relative paths work first and then, then fix the other issues that remains with lock-file invalidation. Sorry about this whole thing its all somewhat broken.

    With regards to having that as a contribution, this one might be bit hairy because I'm reckoning it requires changes to rattler (the underlying library) as well. If you DM me on Discord I'd be happy to find something that is a bit lower-hanging fruit though!

  10. tdejager commented on Oct 8, 2025

    @tdejager
    Contributor

    Wait, now that I think of it there might be an intial fix for this first! Let me investigate.

  11. eightysteele commented on Oct 8, 2025

    @eightysteele
    Author

    Thanks @tdejager, that sounds good! Let's see what the investigation turns up and then I'm happy to DM on Discord for any low-hanging fruit that would be helpful.

  12. tdejager commented on Oct 8, 2025

    @tdejager
    Contributor

    So I fixed the initial problem with this PR: #4710

    This now parses the url we get back from the locking process correctly. However, we now run into another problem, because we do not know from the pep508 requirement if this is an editable (and frankly we shouldn't care per se) we now still have a lock invalidation issue.

    Running on your repro I now get:

    INFO pixi_core::lock_file::outdated: the pypi dependencies of environment 'default' for platform linux-64 are out of date because expected b and c NOT to be editable but in the lock-file they are
    

    The problem being, that we return these as non-editable from the conversion method. And these are cross-referenced with the editables required and this conflicts. We can solve this (I think), by re-using the data in the lock file to figure out if we want that requirement to be editable or not. I think you could try this contribution, feel free to DM for the details.

  13. eightysteele commented on Oct 9, 2025

    @eightysteele
    Author

    @tdejager nice, #4710 lgtm. I'm game for trying the contribution—I'll DM you to get the details (I'm on Pacific Time in California, with a tendency to wake up super early and work, so we might be coordinating over some rather strange hours!)

  14. jevandezande commented on May 24, 2026

    @jevandezande
    Contributor

    I think I'm having the same problem (running Pixi 0.69.0). The underlying problem looks like a writer/reader asymmetry around [tool.uv.sources].

    When pixi writes the lockfile, it resolves pkg-a's dependencies with pkg-a's [tool.uv.sources] applied, so requires_dist for pkg-a is serialized as:

    - pypi: ./pkg-a
      name: pkg-a
      requires_dist:
      - pkg-b @ ../pkg-b      # ← URL form, sourced from pkg-a's [tool.uv.sources]
      requires_python: '>=3.13'

    When the up-to-date check reads pkg-a/pyproject.toml, it parses only [project.dependencies]:

    dependencies = ["pkg-b"]   # ← bare name; [tool.uv.sources] not applied

    The diff between pkg-b @ ../pkg-b (lockfile) and pkg-b (manifest) is then reported as both an addition and a removal under the same name:

    INFO pixi_core::lock_file::outdated: the pypi dependencies of environment 'default'
    for platform linux-64 are out of date because metadata for local package 'pkg-a'
    has changed: dependencies changed - added: [pkg-b], removed: [pkg-b]
    

    Minimal reproduction

    set -euo pipefail
    dir=$(mktemp -d) && cd "$dir"
    mkdir -p workspace/src/workspace workspace/pkg-a/src/pkg_a workspace/pkg-b/src/pkg_b
    touch workspace/src/workspace/__init__.py \
          workspace/pkg-a/src/pkg_a/__init__.py \
          workspace/pkg-b/src/pkg_b/__init__.py
    
    cat > workspace/pyproject.toml <<'EOF'
    [project]
    name = "workspace"
    version = "0.0.1"
    requires-python = ">=3.13"
    dependencies = ["pkg-a"]
    
    [tool.pixi.workspace]
    channels = ["conda-forge"]
    platforms = ["linux-64"]
    requires-pixi = ">=0.69"
    
    [tool.pixi.pypi-dependencies]
    workspace = { path = ".", editable = true }
    pkg-a     = { path = "./pkg-a", editable = true }
    
    [tool.pixi.environments]
    default = { solve-group = "default" }
    
    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"
    EOF
    
    cat > workspace/pkg-a/pyproject.toml <<'EOF'
    [project]
    name = "pkg-a"
    version = "0.0.1"
    requires-python = ">=3.13"
    dependencies = ["pkg-b"]
    
    [tool.uv.sources]
    pkg-b = { path = "../pkg-b", editable = true }
    
    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"
    EOF
    
    cat > workspace/pkg-b/pyproject.toml <<'EOF'
    [project]
    name = "pkg-b"
    version = "0.0.1"
    requires-python = ">=3.13"
    
    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"
    EOF
    
    cd workspace
    pixi install                                                          # succeeds
    RUST_LOG=pixi_core::lock_file::outdated=info pixi install --locked    # FAILS
    

    The workspace does not need to list pkg-b itself, the bug is triggered purely by transitive resolution through pkg-a's [tool.uv.sources].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buglock filepypiuv

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions