Repository: Isotr0py/pillow-jpegxl-plugin (language: python)

Issue:
Problem installing via pip - outdated dependency
I'm trying to install this library using `pip install pillow-jxl-plugin` and getting the error below. From the error it looks like the plugin depends on `jpegxl-src v0.10.2` which appears to have been yanked:
<img width="480" alt="image" src="https://github.com/Isotr0py/pillow-jpegxl-plugin/assets/12499997/4b592f09-ea20-4e5a-99cb-5c39e76057dd">

I'm not sure exactly where this version number is specified as a dependency.
 
Here's the full error:
```
> pip install pillow-jxl-plugin
Collecting pillow-jxl-plugin
  Using cached pillow_jxl_plugin-1.2.4.tar.gz (240 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [22 lines of output]
          Updating crates.io index
      error: failed to get `jpegxl-src` as a dependency of package `jpegxl-sys v0.10.2+libjxl-0.10.2 (/private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-install-k9kqq3ux/pillow-jxl-plugin_d0d7e5cf120943aaaf3babcda3d40a5d/jpegxl-rs/jpegxl-sys)`
          ... which satisfies path dependency `jpegxl-sys` (locked to 0.10.2+libjxl-0.10.2) of package `jpegxl-rs v0.10.2+libjxl-0.10.2 (/private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-install-k9kqq3ux/pillow-jxl-plugin_d0d7e5cf120943aaaf3babcda3d40a5d/jpegxl-rs/jpegxl-rs)`
          ... which satisfies path dependency `jpegxl-rs` (locked to 0.10.2+libjxl-0.10.2) of package `pillow-jxl-plugin v1.2.4 (/private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-install-k9kqq3ux/pillow-jxl-plugin_d0d7e5cf120943aaaf3babcda3d40a5d)`
      
      Caused by:
        failed to load source for dependency `jpegxl-src`
      
      Caused by:
        Unable to update /private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-install-k9kqq3ux/pillow-jxl-plugin_d0d7e5cf120943aaaf3babcda3d40a5d/jpegxl-rs/jpegxl-src
      
      Caused by:
        failed to read `/private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-install-k9kqq3ux/pillow-jxl-plugin_d0d7e5cf120943aaaf3babcda3d40a5d/jpegxl-rs/jpegxl-src/Cargo.toml`
      
      Caused by:
        No such file or directory (os error 2)
      💥 maturin failed
        Caused by: Cargo metadata failed. Does your crate compile with `cargo build`?
        Caused by: `cargo metadata` exited with an error:
      Error running maturin: Command '['maturin', 'pep517', 'write-dist-info', '--metadata-directory', '/private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-modern-metadata-dt91j0oq', '--interpreter', '/Users/Tom/anaconda3/bin/python']' returned non-zero exit status 1.
      Checking for Rust toolchain....
      Running `maturin pep517 write-dist-info --metadata-directory /private/var/folders/w8/m4st6m2j6vn3l2wdw83gj60m0000gp/T/pip-modern-metadata-dt91j0oq --interpreter /Users/Tom/anaconda3/bin/python`
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
```

@dgutman I think this is the cause of the error we both are seeing.


Discussion / hints:
Which platform and python version do you use? It seems that `pip` doesn't find a matched prebuilt wheel for your python. Installation through `pip` is expected to install the pre-built wheels instead of the source code.

Building from source through `pip` may not work for current version, because we use a modified `jpegxl-rs` fork branch to support exif encoding temporarily. 

This will be duplicated once they release the new version on the main branch which added exif support.
MacOS Ventura 13.3, Apple M1 Max chip. Cpython 3.10.14.

Strangely, I was getting the same error back in early May, but the next day I was able to install this package again with `pip install`(issue here: https://github.com/girder/large_image/issues/1475). 
Emmm, this may cause by our update `setup-python@v4` to `setup-python@v5`. It seems that `setup-python@v5` in release CI doesn't setup Cpython3.10 on macos by default, and it only set up python3.11 and python3.12...

I will fix this later.

Fix patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c24e539..4fe9829 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -118,10 +118,14 @@ jobs:
           path: dist
 
   macos:
-    runs-on: macos-latest
+    runs-on: ${{ matrix.platform.runner }}
     strategy:
       matrix:
-        target: [x86_64, aarch64]
+        platform:
+          - runner: macos-latest
+            target: x86_64
+          - runner: macos-14
+            target: aarch64
     steps:
       - uses: actions/checkout@v4
         with:
@@ -129,7 +133,7 @@ jobs:
 
       - uses: actions/setup-python@v5
         with:
-          architecture: ${{ matrix.target }}
+          python-version: '3.10'
       
       - name: Check dependencys
         run: |
@@ -146,16 +150,16 @@ jobs:
           # from homebrew
           DEP_JXL_LIB: /opt/homebrew/Cellar/jpeg-xl/0.10.2/lib
           DEP_BROTLI_LIB: /opt/homebrew/Cellar/brotli/1.1.0/lib
-          DEP_HWY_LIB: /opt/homebrew/Cellar/highway/1.1.0/lib
+          DEP_HWY_LIB: /opt/homebrew/Cellar/highway/1.2.0/lib
         with:
-          target: ${{ matrix.target }}
+          target: ${{ matrix.platform.target }}
           args: --release --out dist --find-interpreter --features dynamic
           sccache: 'true'
 
       - name: Upload wheels
         uses: actions/upload-artifact@v4
         with:
-          name: wheels-macos-${{ matrix.target }}
+          name: wheels-macos-${{ matrix.platform.target }}
           path: dist
 
   sdist:


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d6547e7..506c6eb 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -43,7 +43,7 @@ jobs:
           brew install jpeg-xl
           export DEP_JXL_LIB=/opt/homebrew/Cellar/jpeg-xl/0.10.2/lib
           export DEP_BROTLI_LIB=/opt/homebrew/Cellar/brotli/1.1.0/lib
-          export DEP_HWY_LIB=/opt/homebrew/Cellar/highway/1.1.0/lib
+          export DEP_HWY_LIB=/opt/homebrew/Cellar/highway/1.2.0/lib
           source venv/bin/activate
           pip install maturin
           maturin develop --features dynamic