prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
2.91k stars 160 forks source link

pixi init --import error invalid bracket #1901

Closed cdeil closed 2 weeks ago

cdeil commented 2 weeks ago

Checks

Reproducible example

(base) hpred $ pixi --version
pixi 0.28.0
(base) hpred $ pixi init --import ./environment-py12.yml 
  × invalid bracket

(base) hpred $ cat environment-py12.yml 
name: hpred12
channels:
  - nodefaults
  - conda-forge
dependencies:
  - python=3.12
  - pandas[performance]
  - scikit-learn
  - numpy

  - sqlalchemy
  - psycopg
  - pymssql

  # data files
  - pyarrow   # Parquet
  - openpyxl  # Excel

  # ML
  - ruptures
  - category_encoders
  - ppscore
  - dill
  - imbalanced-learn
  - scikit-lego

  # local dev
  - pre-commit # Also for CI
  - jupyterlab
  - alembic

  # viz
  - matplotlib
  - seaborn
  - bokeh
  - hiplot
  - shap
  - ipywidgets

  # Panel apps
  - panel
  - param
  - pyinstrument
  - tabulate
  - python-duckdb
  - duckdb-cli
  - click
  - nbconvert
  - missingno

  # testing
  - pytest
  - pytest-mock
  - pytest-cov
  - pytest-postgresql

  - pip
  - pip:
    # data
    - sqlalchemy-json

    # Azure
    - azure-core
    - azure-identity
    - azure-keyvault-secrets
    - azure-storage-blob
    - azure-kusto-data[pandas]  # ADX
    - opencensus-ext-azure  # Azure Application Insights

    # app
    - schedule
    - pytest-playwright

    # local DS
    - dvc[azure]

    # Panel
    - pyjwt
    - typing-extensions

Issue description

pixi init --import gives error on valid conda env file (see above)

Expected behavior

pixi init works. :-)

baszalmstra commented 2 weeks ago

The problem is with pandas[performance] which is not a valid package name because op the brackets. Conda ignores this for some reason. If you remove the [performance] part it should work.

cdeil commented 2 weeks ago

Thanks!

Maybe you could ignore it as well and/or give a warning/error at least mentioning the problematic line/entry?

After I fix it I get this error which for me is also cryptic since there's no mention why the problematic package nanotime appears here, i.e. which of my dependencies try to drag it in and I have to adjust. And why the invalid gzip error?

(base) hpred $ pixi init --import environment-py12.yml
  ⠉ default:osx-arm64    [00:00:03] resolving vine==5.1.0                                                                                                           × failed to solve the pypi requirements of 'default' 'osx-arm64'
  ├─▶ failed to resolve pypi dependencies
  ├─▶ Failed to download and build `nanotime==0.5.2`
  ├─▶ Failed to install requirements from build-system.requires (install)
  ├─▶ Failed to prepare distributions
  ├─▶ Failed to fetch wheel: setuptools==72.2.0
  ├─▶ Failed to extract archive
  ╰─▶ Invalid gzip header
akhmerov commented 2 weeks ago

I start seeing "Invalid gzip header" error too, e.g. in this pipeline: https://gitlab.kwant-project.org/qt/pymablock/-/jobs/445192#L30

akhmerov commented 2 weeks ago

Removing .pixi folder and installing everything again seemingly fixed the problem :man_shrugging:

ruben-arts commented 2 weeks ago

The ╰─▶ Invalid gzip header issue is going to be fixed by using no-build-isolation from #1909 so fix is on it's way.

cdeil commented 2 weeks ago

I still get the same error:

  ⠚ default:osx-arm64    [00:00:00] resolving nanotime==0.5.2                                                                                                                       × failed to solve the pypi requirements of 'default' 'osx-arm64'
  ├─▶ failed to resolve pypi dependencies
  ├─▶ Failed to download and build `nanotime==0.5.2`
  ├─▶ Failed to install requirements from build-system.requires (install)
  ├─▶ Failed to prepare distributions
  ├─▶ Failed to fetch wheel: setuptools==72.2.0
  ├─▶ Failed to extract archive
  ╰─▶ Invalid gzip header

The problematic package is https://pypi.org/project/dvc which for some reason pixi attempts to install https://pypi.org/project/nanotime which I think it shouldn't, or at least pip doesn't do that.