Skip to content

Can't install h5py on MacOs M1 #6093

Closed
Closed

Description

@tensionhead
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: 12.2 and MacOS Montery
  • Poetry version: 1.1.14
  • Gist with the contents of your pyproject.toml file:

Issue

I am having trouble installing h5py as dependency for my project. For the ARM M1 macs, that was a problem also for pip a while ago, but it got fixed: h5py/h5py#2065

I am actually also able to install h5py just fine system wide with pip3 install h5py, however if I try with poetry install I get:

Installing dependencies from lock file

Package operations: 12 installs, 0 updates, 0 removals

  • Installing h5py (2.10.0): Failed

  EnvCommandError

  Command ['/Users/xxx/Library/Caches/pypoetry/virtualenvs/esi-syncopy-vESaVMMA-py3.8/bin/pip', 'install', '--no-deps', 'file:///Users/xxx/Library/Caches/pypoetry/artifacts/e1/c6/e9/c8624c01cae03e2dcc08141108abf4864b207a81f6baec2b7d2f519af9/h5py-2.10.0.tar.gz'] errored with the following return code 1, and output:
  Processing /Users/xxx/Library/Caches/pypoetry/artifacts/e1/c6/e9/c8624c01cae03e2dcc08141108abf4864b207a81f6baec2b7d2f519af9/h5py-2.10.0.tar.gz
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'done'
  Building wheels for collected packages: h5py
    Building wheel for h5py (setup.py): started
    Building wheel for h5py (setup.py): finished with status 'error'
    error: subprocess-exited-with-error

    × python setup.py bdist_wheel did not run successfully.
    │ exit code: 1
    ╰─> [8 lines of output]
        /Users/xxx/Library/Caches/pypoetry/virtualenvs/esi-syncopy-vESaVMMA-py3.8/lib/python3.8/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
          warnings.warn(
        running bdist_wheel
        running build
        running build_py
        running build_ext
        Loading library to get version: libhdf5.dylib
        error: dlopen(libhdf5.dylib, 0x0006): tried: 'libhdf5.dylib' (no such file), '/usr/local/lib/libhdf5.dylib' (no such file), '/usr/lib/libhdf5.dylib' (no such file), '/private/var/folders/wq/b2v4yh29055d_mcsphwlmk8c0000gp/T/pip-req-build-s81x_dn1/libhdf5.dylib' (no such file), '/usr/local/lib/libhdf5.dylib' (no such file), '/usr/lib/libhdf5.dylib' (no such file)
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for h5py
    Running setup.py clean for h5py
  Failed to build h5py
  Installing collected packages: h5py
    Running setup.py install for h5py: started
    Running setup.py install for h5py: finished with status 'error'
    error: subprocess-exited-with-error

    × Running setup.py install for h5py did not run successfully.
    │ exit code: 1
    ╰─> [10 lines of output]
        /Users/xxx/Library/Caches/pypoetry/virtualenvs/esi-syncopy-vESaVMMA-py3.8/lib/python3.8/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
          warnings.warn(
        running install
        /Users/xxx/Library/Caches/pypoetry/virtualenvs/esi-syncopy-vESaVMMA-py3.8/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
          warnings.warn(
        running build
        running build_py
        running build_ext
        Loading library to get version: libhdf5.dylib
        error: dlopen(libhdf5.dylib, 0x0006): tried: 'libhdf5.dylib' (no such file), '/usr/local/lib/libhdf5.dylib' (no such file), '/usr/lib/libhdf5.dylib' (no such file), '/private/var/folders/wq/b2v4yh29055d_mcsphwlmk8c0000gp/T/pip-req-build-s81x_dn1/libhdf5.dylib' (no such file), '/usr/local/lib/libhdf5.dylib' (no such file), '/usr/lib/libhdf5.dylib' (no such file)
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: legacy-install-failure

  × Encountered error while trying to install package.
  ╰─> h5py

  note: This is an issue with the package mentioned above, not pip.
  hint: See above for output from the failure.


  at ~/.poetry/lib/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│
      1197│         return decode(output)
      1198│
      1199│     def execute(self, bin, *args, **kwargs):

I tried installing the binaries outside of poetry (with brew), and run poetry add h5py --no-binary which I thought was supported since #5600, however I get a NoSuchOptionException.

Activity

  1. dimbleby commented on Jul 29, 2022

    @dimbleby
    Contributor

    poetry is just running pip, and pip is telling you what the problem is:

            Loading library to get version: libhdf5.dylib
            error: dlopen(libhdf5.dylib, 0x0006): tried: 'libhdf5.dylib' (no such file), '/usr/local/lib/libhdf5.dylib' (no such file), '/usr/lib/libhdf5.dylib' (no such file), '/private/var/folders/wq/b2v4yh29055d_mcsphwlmk8c0000gp/T/pip-req-build-s81x_dn1/libhdf5.dylib' (no such file), '/usr/local/lib/libhdf5.dylib' (no such file), '/usr/lib/libhdf5.dylib' (no such file)
            [end of output]
    

    poetry cannot fix this for you.

  2. tensionhead commented on Jul 29, 2022

    @tensionhead
    Author

    Ok.. well the system pip has no problem, any ideas how this diverging behaviour is possible?

  3. mkniewallner commented on Jul 29, 2022

    @mkniewallner
    Member

    The output you shared indicates that Poetry tries to install 2.10.0, which does not contain the fix you mention in h5py/h5py#2065, so you probably need to update your lockfile, or update the minimum range for h5py, then retry the install to get a newer version of h5py.

  4. tensionhead commented on Jul 30, 2022

    @tensionhead
    Author

    Thx @mkniewallner, indeed the pinning of h5py<3 was the problem! Due to another dependency I can't change this right now on the repo, but I could install h5py 3.7 without problems on my M1 with poetry so I am closing this 🙂

  5. github-actions commented on Mar 1, 2024

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  6. locked as resolved and limited conversation to collaborators on Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions