pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Show version constraints in `pixi tree -i`

Open dhirschfeld opened this issue 10 months ago • 6 comments

Problem description

pixi tree -i is a fantastic tool to understand your dependencies, but it could be more useful if the constraints could also be shown for the requested package.

In the example below I can see all the packages which depend on pyarrow==0.19.0, but I'm more concerned by what versions of pyarrow each package allows so I can debug why installing fails with an earlier version of pyarrow.

❯ pixi tree -i pyarrow
 WARN The package `requests==2.32.3` does not have an extra named `socks`
 WARN The package `pyjwt==2.10.1` does not have an extra named `crypto`

pyarrow 19.0.0 
├── textual_fastdatatable 0.12.0 
├── turbodbc 5.1.2 
├── databricks_connect 14.3.7 
├── vegafusion 1.6.9 
│   └── vegafusion_jupyter 1.6.9 
└── deltalake 0.24.0 


pyarrow-core 19.0.0 
└── pyarrow 19.0.0 (*)

dhirschfeld avatar Feb 09 '25 12:02 dhirschfeld

If I uncomment the databricks-sqlalchemy dep I get the below error message:

❯ pixi tree -i pyarrow
Error: 
  × Failed to update lock file
  ├─▶ failed to solve the pypi requirements of 'default' 'linux-64'
  ├─▶ failed to resolve pypi dependencies
  ╰─▶ Because databricks-sqlalchemy==2.0.4 depends on pyarrow>=14.0.1,<17 and pyarrow==19.0.0, we can conclude that databricks-sqlalchemy==2.0.4 cannot be used.
      And because only databricks-sqlalchemy<=2.0.4 is available and you require databricks-sqlalchemy>=2.0.4, we can conclude that your requirements are unsatisfiable.

...but I don't know why pyarrow 19.0.0 is required.

dhirschfeld avatar Feb 09 '25 12:02 dhirschfeld

Sounds like a good idea to me, any idea regarding the complexity @ruben-arts?

tdejager avatar Feb 13 '25 08:02 tdejager

It's not completely clear to me what the request is. Could you make a mock result of what you are looking for.

This issue with this error is that pyarrow==19.0.0 is coming from the conda package being installed. We would really improve the experience if that would be made clear in the error message.

ruben-arts avatar Feb 13 '25 09:02 ruben-arts

It's not completely clear to me what the request is. Could you make a mock result of what you are looking for.

I've run into this again when trying to understand why the installed version of pandoc is 2.4 in my environment.

I ran pixi tree -i pandoc which gives me:

pandocfilters 1.5.0 
└── nbconvert-core 7.16.6 
    ├── nbconvert 7.16.6 
    │   ├── voila 0.5.8 
    │   └── mkdocs_jupyter 0.25.1 
    ├── nbconvert-pandoc 7.16.6 
    │   └── nbconvert 7.16.6 (*)
    └── jupyter_server 2.15.0 
        ├── notebook-shim 0.2.4 
        │   └── jupyterlab 4.4.0 
        │       ├── jupyterlab-lsp 5.1.0 
        │       ├── theme-material-darcula 1.0.3 
        │       └── jupyterlab_execute_time 3.2.0 
        ├── voila 0.5.8 (*)
        ├── jupyterlab 4.4.0 (*)
        ├── jupyter-lsp 2.2.5 
        │   ├── jupyterlab-lsp 5.1.0 (*)
        │   └── jupyterlab 4.4.0 (*)
        ├── jupyterlab_server 2.27.3 
        │   ├── voila 0.5.8 (*)
        │   └── jupyterlab 4.4.0 (*)
        ├── jupyter-server-proxy 4.4.0 
        └── pixi-kernel 0.6.2 

nbconvert-pandoc 7.16.6 (*)

pandoc 2.4 
└── nbconvert-pandoc 7.16.6 (*)

But that doesn't tell me why specifically version 2.4 is installed.

Looking at the deps of all packages, I'm left with more questions than answers!

I've shown the pandoc constraints of all packages below:

Package Pandoc Constraint
pandocfilters 1.5.0 
└── nbconvert-core 7.16.6 
    ├── nbconvert 7.16.6 
    │   ├── voila 0.5.8 
    │   └── mkdocs_jupyter 0.25.1 
    ├── nbconvert-pandoc 7.16.6 
    │   └── nbconvert 7.16.6 (*)
    └── jupyter_server 2.15.0 
        ├── notebook-shim 0.2.4 
        │   └── jupyterlab 4.4.0 
        │       ├── jupyterlab-lsp 5.1.0 
        │       ├── theme-material-darcula 1.0.3 
        │       └── jupyterlab_execute_time 3.2.0 
        ├── voila 0.5.8 (*)
        ├── jupyterlab 4.4.0 (*)
        ├── jupyter-lsp 2.2.5 
        │   ├── jupyterlab-lsp 5.1.0 (*)
        │   └── jupyterlab 4.4.0 (*)
        ├── jupyterlab_server 2.27.3 
        │   ├── voila 0.5.8 (*)
        │   └── jupyterlab 4.4.0 (*)
        ├── jupyter-server-proxy 4.4.0 
        └── pixi-kernel 0.6.2 

nbconvert-pandoc 7.16.6 (*)

pandoc 2.4 
└── nbconvert-pandoc 7.16.6 (*)
-
>=2.9.2,<4.0.0
-
-
-
*
-
-
-
-
-
-
-
-
-
-
- 
-
-
-
-
-
-

*

???                              
*

i.e. in all the reported packages only nbconvert-pandoc directly depends on any version of pandoc and nbconvert-core has a run constraint on version >=2.9.2,<4.0.0 of pandoc.

It would be good to indicate (as above) which of the reported packages do in fact have dependencies or constraints on the requested package.

I guess the tree shows everything that depends on nbconvert-core which tells you why that package is in the environment which is useful information. But without knowing which are constibuting actual constraints on the requested package it makes it hard to track down dependency bugs.

pandocfilters doesn't depend on pandoc so why is it at the root of the first branch?

pandoc==2.4 doesn't obey the nbconvert-core run constraint - is that a bug?

If nbconvert-pandoc can use any version of pandoc why is 2.4 chosen rather than 3.6.4?

dhirschfeld avatar Apr 09 '25 12:04 dhirschfeld

If nbconvert-pandoc can use any version of pandoc why is 2.4 chosen rather than 3.6.4?

That was the main question I was trying to answer with pixi tree -i pandoc

dhirschfeld avatar Apr 09 '25 12:04 dhirschfeld

Also, what does the (*) mean in the output? It doesn't mean that package has a direct dependency as I originally assumed.

dhirschfeld avatar Apr 09 '25 12:04 dhirschfeld

The * means that its already reported higher up in the tree and so its dependencies are omitted.

How would you suggest that we print constraints? The tree is now created based on the dependencies.

baszalmstra avatar Jul 01 '25 08:07 baszalmstra

Formatting could be tricky. Maybe just use interval notation next to the version? i.e.

nbconvert-core 7.16.6, [2.9.2, 4.0.0)
nbconvert-pandoc 7.16.6, [0, ∞)

The tree is now created based on the dependencies

I'll have to check it out again!

dhirschfeld avatar Jul 01 '25 11:07 dhirschfeld