Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save julian-r/2aeb06f415406a857a8afa3bf57861ea to your computer and use it in GitHub Desktop.
Save julian-r/2aeb06f415406a857a8afa3bf57861ea to your computer and use it in GitHub Desktop.

Problem is h5py is needed in a version 2.x.x which does not compile.

The errormessage is quite long, looks somehow like this:

...
      /tmp/pip-req-build-3eriu_nn/h5py/h5i.c: In function ‘__pyx_pymod_exec_h5i’:
      /tmp/pip-req-build-3eriu_nn/h5py/h5i.c:3183:43: error: ‘H5I_REFERENCE’ undeclared (first use in this function); did you mean ‘H5T_REFERENCE’?
       3183 |   __pyx_t_2 = __Pyx_PyInt_From_H5I_type_t(H5I_REFERENCE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
            |                                           ^~~~~~~~~~~~~
            |                                           H5T_REFERENCE
      /tmp/pip-req-build-3eriu_nn/h5py/h5i.c:3183:43: note: each undeclared identifier is reported only once for each function it appears in
      In file included from /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:21,
                       from /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from /tmp/pip-req-build-3eriu_nn/h5py/api_compat.h:26,
                       from /tmp/pip-req-build-3eriu_nn/h5py/h5i.c:654:
      At top level:
      /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/numpy/core/include/numpy/__multiarray_api.h:1463:1: warning: ‘_import_array’ defined but not used [-Wunused-function]
       1463 | _import_array(void)
            | ^~~~~~~~~~~~~
      error: command '/usr/bin/gcc' failed with exit code 1
      ----------------------------------------
    Rolling back uninstall of h5py
    Moving to /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/h5py-3.1.0.dist-info/
     from /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/~5py-3.1.0.dist-info
    Moving to /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/h5py.libs/
     from /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/~5py.libs
    Moving to /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/h5py/
     from /home/julian/learning/deeplizard-2-keras/playground/.venv/lib/python3.9/site-packages/~5py
  ERROR: Command errored out with exit status 1: /home/julian/learning/deeplizard-2-keras/playground/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-3eriu_nn/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-3eriu_nn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-g0xff75k/install-record.txt --single-version-externally-managed --compile --install-headers /home/julian/learning/deeplizard-2-keras/playground/.venv/include/site/python3.9/h5py Check the logs for full command output.

found this: https://github.com/archlinux/svntogit-community/commit/d6a557d7c00dac240370c216f926bd89aafb65bd

git clone git@github.com:h5py/h5py.git

https://raw.githubusercontent.com/archlinux/svntogit-community/d6a557d7c00dac240370c216f926bd89aafb65bd/trunk/python-h5py-hd5-1.12.patch
wget https://raw.githubusercontent.com/archlinux/svntogit-community/d6a557d7c00dac240370c216f926bd89aafb65bd/trunk/h5py-2.10.0-hdf5-v1.12-h5i.patch

git checkout 2.10.0
patch -p1 -i h5py-2.10.0-hdf5-v1.12-h5i.patch
patch -p1 -i python-h5py-hd5-1.12.patch

cd <your project>
poetry add <h5py path>/h5py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment