pixi icon indicating copy to clipboard operation
pixi copied to clipboard

bug(pypi): solve-group fails when the group contains a dependency as both editable and not

Open gbolmier opened this issue 1 year ago • 2 comments

Checks

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

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

Reproducible example

Commands I ran and their output:

$ pixi install --all
Error:   × failed to solve the pypi requirements of environment 'dev-prod' for platform 'osx-arm64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Requirements contain conflicting URLs for package `project`:
      - file:///Users/gbolmier/Documents/repositories/project
      - file:///Users/gbolmier/Documents/repositories/project (editable)

pyproject.toml file that reproduces my issue:

[project]
name    = "project"
version = "0.1.0"

[tool.pixi.workspace]
channels  = ["conda-forge"]
platforms = ["osx-arm64"]

[tool.pixi.environments]
dev  = { features = ["project-editable"], solve-group = "dev-prod" }
prod = { features = ["project"],          solve-group = "dev-prod" }

[tool.pixi.feature.project-editable.pypi-dependencies]
project = { path = ".", editable = true }

[tool.pixi.feature.project.pypi-dependencies]
project = { path = "." }

pixi info output:

System
------------
       Pixi version: 0.59.0
           Platform: osx-arm64
   Virtual packages: __unix=0=0
                   : __osx=15.6.1=0
                   : __archspec=1=m2
          Cache dir: /Users/gbolmier/Library/Caches/rattler/cache
       Auth storage: /Users/gbolmier/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /Users/gbolmier/.pixi/bin
    Environment dir: /Users/gbolmier/.pixi/envs
       Manifest dir: /Users/gbolmier/.pixi/manifests/pixi-global.toml

Workspace
------------
               Name: project
            Version: 0.1.0
      Manifest file: /Users/gbolmier/Documents/repositories/project/pyproject.toml

Environments
------------
        Environment: default
           Features: default
           Channels: conda-forge
   Dependency count: 1
       Dependencies: python
   Target platforms: osx-arm64
    Prefix location: /Users/gbolmier/Documents/repositories/project/.pixi/envs/default

        Environment: dev
           Features: project-editable, default
        Solve group: dev-prod
           Channels: conda-forge
   Dependency count: 1
       Dependencies: python
  PyPI Dependencies: project
   Target platforms: osx-arm64
    Prefix location: /Users/gbolmier/Documents/repositories/project/.pixi/envs/dev

        Environment: prod
           Features: project, default
        Solve group: dev-prod
           Channels: conda-forge
   Dependency count: 1
       Dependencies: python
  PyPI Dependencies: project
   Target platforms: osx-arm64
    Prefix location: /Users/gbolmier/Documents/repositories/project/.pixi/envs/prod

Issue description

I'm not sure if this is a bug report or a feature request.

solve-group fails when the group contains a dependency as both editable and not. For example, Env1 depends on a given local package and Env2 depends on the same package but in editable mode.

Expected behavior

I would expect it to not fail as from what I understand, whether a local package is installed as editable or not shouldn't change that package dependencies. Please let me know if I'm missing something.

gbolmier avatar Oct 29 '25 20:10 gbolmier

Additionally, if we remove the solve-group from the manifest and install all the environments, then the lock-file gets out of sync with the manifest, see:

$ pixi install --all           
✔ The following environments have been installed: default, dev, prod.
$ pixi shell --locked -e dev -v
 INFO pixi_core::lock_file::outdated: the pypi dependencies of environment 'dev' for platform osx-arm64 are out of date because expected project to be editable but in the lock-file it is not
Error:   × lock-file not up-to-date with the workspace

I suspect this happens because both the editable and not editable local package dependencies share the same identifier, see from the lock-file, the only difference is the editable line :

...
- pypi: ./
  name: project
  version: 0.1.0
  sha256: be35d5f31031655cca66a82ffc9016811e3728b72a6a474db4c53c6f78fb7c8c
  editable: true
- pypi: ./
  name: project
  version: 0.1.0
  sha256: be35d5f31031655cca66a82ffc9016811e3728b72a6a474db4c53c6f78fb7c8c
...

gbolmier avatar Oct 30 '25 03:10 gbolmier

I think solving this https://github.com/prefix-dev/pixi/issues/1274 will allow us to uplift this restriction

nichtmacho avatar Oct 30 '25 07:10 nichtmacho