Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an error when saving hdf5 file after fitting #32

Closed
mjastro opened this issue Jan 9, 2023 · 5 comments
Closed

an error when saving hdf5 file after fitting #32

mjastro opened this issue Jan 9, 2023 · 5 comments

Comments

@mjastro
Copy link

mjastro commented Jan 9, 2023

Hi,

I have recently changed my conda environment from anaconda3 to miniforge and reinstalled the bagpipes, and now I am getting the following error message which seems to be relevant to the hdf5 (when saving the fitting result) that bagpipes is using.

File "/opt/homebrew/Caskroom/miniforge/base/envs/bagpipes/lib/python3.10/site-packages/bagpipes/fitting/fit.py", line 150, in fit
    dd.io.save(self.fname[:-1] + ".h5", self.results)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/bagpipes/lib/python3.10/site-packages/deepdish/io/hdf5io.py", line 584, in save
    _save_level(h5file, group, value, name=key,
  File "/opt/homebrew/Caskroom/miniforge/base/envs/bagpipes/lib/python3.10/site-packages/deepdish/io/hdf5io.py", line 250, in _save_level
    _save_ndarray(handler, group, name, level, filters=filters)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/bagpipes/lib/python3.10/site-packages/deepdish/io/hdf5io.py", line 125, in _save_ndarray
    elif x.dtype == np.object:
  File "/opt/homebrew/Caskroom/miniforge/base/envs/bagpipes/lib/python3.10/site-packages/numpy/__init__.py", line 284, in __getattr__
    raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'object'. Did you mean: 'object_'?

I am suspecting this might not be an issue directly relevant to bagpipes' rather on my side but would still wonder whether any of you can help me if you have encountered the same issue.

I am using Mac (M1 silicon) and I had an issue when installing the bagpipes with this new setup (i.e., everything set on the arm architecture) and I have to manually specify the HDF5_DIR by typing export HDF5_DIR="$(brew --prefix hdf5)", which then completed the bagpipes installation.

Following is the error when I got trying to install bagpipes using pip install bagpipes


  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      /var/folders/r0/7k7m3h6j2xxg6chj893x90km0000gp/T/H5closetkx7wfdz.c:2:5: error: implicit declaration of function 'H5close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          H5close();
          ^
      1 error generated.
      cpuinfo failed, assuming no CPU features: 'flags'
      * Using Python 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:25:29) [Clang 14.0.6 ]
      * Found cython 0.29.33
      * USE_PKGCONFIG: False
      * Found conda env: ``/opt/homebrew/Caskroom/miniforge/base/envs/bagpipes``
      .. 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.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

Thank you very much for any help you could offer!!

Best,
Minju

@ACCarnall
Copy link
Owner

Hi Minju,

This appears to be an issue with the deepdish module, which is not yet compatible with numpy >= 1.2.4:

uchicago-cs/deepdish#50

Hopefully this will be patched soon, but in the mean time if you downgrade your numpy version this should make things work again.

Cheers,
Adam

@mjastro
Copy link
Author

mjastro commented Jan 9, 2023

aha! With the downgrade, it worked. Thanks a lot!! :)

@mjastro mjastro closed this as completed Jan 9, 2023
@hantke
Copy link

hantke commented Feb 20, 2023

Actually, if you just modify np.object -> object, then the code become compatible with the latest numpy version (at least it worked for me)

@ACCarnall
Copy link
Owner

Just to note that I've now replaced deepdish with h5py from bagpipes v1.0.2, so hopefully the code should now again be compatible with the most recent versions of numpy.

@ACCarnall
Copy link
Owner

Just to further note that I've just fixed a bug with this in the new v1.2.0 bagpipes release which was causing a strange error "numpy has no attribute np".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants