NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.62k stars 13.77k forks source link

hdf5 missing from $NIX_LD_LIBRARY_PATH #317539

Open adminy opened 4 months ago

adminy commented 4 months ago

cannot find -lhdf5: No such file or directory

Steps To Reproduce

Steps to reproduce the behavior:

  1. install ldf5 and uv into your nixos system packages
  2. run: uv pip install tables==3.6.1

Expected behavior

It should be able to load ldf5 library from the list of libaries available in $NIX_LD_LIBRARY_PATH and install the python package.

Actual

error: Failed to download distributions
  Caused by: Failed to fetch wheel: tables==3.6.1
  Caused by: Failed to build: `tables==3.6.1`
  Caused by: Build backend failed to build wheel through `build_wheel()` with exit status: 1
--- stdout:
* Using Python 3.10.14 (main, Mar 19 2024, 21:46:16) [GCC 13.2.0]
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
   You may need to explicitly state where your local HDF5 headers and
   library can be found by setting the ``HDF5_DIR`` environment
   variable or by using the ``--hdf5`` command-line option.
--- stderr:
<string>:18: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
<string>:21: DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead.
/nix/store/bgcaxhhxswzvmxjbbgvvaximm5hwghz1-binutils-2.41/bin/ld: cannot find -lhdf5: No such file or directory
collect2: error: ld returned 1 exit status

Notify maintainers

@markuskowa

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

root in /etc/nixos on master λ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.15.146.1-microsoft-standard-WSL2, NixOS, 24.11 (Vicuña), 24.11.20240605.437e3a2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos, nixos-wsl"`
 - nixpkgs: `/nix/store/4vk4vsnh808b6jlzzkhipkxry9lsrs5r-source`

Add a :+1: reaction to issues you find important.

markuskowa commented 4 months ago

I do not think that is considered a bug, but expected behavior: Putting hfd5 in environment.systemPackages exposes the executables from <store-path>/bin of the package system wide, but not its libraries.

I have never tried to run pip or uv under nix, but it sounds like you rather want to use a nix shell for that purpose.

adminy commented 4 months ago

Okay, so then what is the standard way of exposing libraries in nixos? when I install a package system wide in python for example, I can use that package system wide also without a virtual environment.

But this is C++ land, I'm a bit of a newbie on how nix does c++ stuff.