Version `ZLIB_1.2.9' not found (required by libpng)

I get this Python error while trying to run a project:

Traceback (most recent call last):
  File "/nix/store/xprlxxzf2h78n7p2hss7mch55bnqvjgh-python3.11-gradio-3.44.3/lib/python3.11/site-packages/gradio/", line 38, in <module>
    import matplotlib
  File "/nix/store/q556sbzkyn1jawipz0mqxv5qs0fr01jc-python3.11-matplotlib-3.8.0/lib/python3.11/site-packages/matplotlib/", line 259, in <module>
  File "/nix/store/q556sbzkyn1jawipz0mqxv5qs0fr01jc-python3.11-matplotlib-3.8.0/lib/python3.11/site-packages/matplotlib/", line 244, in _check_versions
    from . import ft2font
ImportError: /nix/store/k8yhrp77shpwcwwlqqdfjsq297p9jxjl-libz-unstable-2018-03-31/lib/ version `ZLIB_1.2.9' not found (required by /nix/store/v8jrcx5r8j74wkb6q3qfv73aizl8vl3z-libpng-apng-1.6.40/lib/

Apparently, libz 1.2.9 is needed, but there’s only version 1.2.8:

$ ls /nix/store/k8yhrp77shpwcwwlqqdfjsq297p9jxjl-libz-unstable-2018-03-31/lib/

Why is the wrong dependency linked? How can I provide version 1.2.9?


I’m trying to get Stable Diffusion to run on my computer with NixOS. The current state of local text-to-image AIs seem to be very broken. I’ve been expecting to just apply band-aids while stumbling from error to error.

But for this error, the last line (about ZLIB_1.2.9 not being found but required by libpng) made me think it might be nix’s fault, not pythons.

If you need any more info, I’m happy to provide, I just didn’t know what would be useful, I’m kinda new and inexperienced with nix.

I now downloaded the zlib 1.2.9 source tarball and compiled it and put the 1.2.9 library at the start of $LD_LIBRARY_PATH. That worked.

Should I sumbit a bug report for libpng-apng?

How do you install your environment? People might be able to help you more if you provide your .nix files reproducing your issue.

What disturbs me is that in uses zlib from top-level, and this zlib is runnig version 1.3, so more modern that your own version: NixOS Search So maybe explaining how you get this environment could help here.

(btw, libz is not exactly like zlib, you seem to mention both)