'Tensorflow ,AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'?

I write this code


from statistics import mode

import cv2

from keras.models import load_model

import numpy as np

import utils

from utils.datasets import get_labels

from utils.inference import detect_faces

from utils.inference import draw_text

from utils.inference import draw_bounding_box

from utils.inference import apply_offsets

from utils.inference import load_detection_model

from utils.preprocessor import preprocess_input

but it doesn't work.

this is error message

AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_16116/1295457466.py in <module>
      2 
      3 import cv2
----> 4 from keras.models import load_model
      5 import numpy as np
      6 import utils


C:\Anaconda3\lib\site-packages\h5py\version.py in <module>
     15 
     16 from collections import namedtuple
---> 17 from . import h5 as _h5
     18 import sys
     19 import numpy

h5py\h5.pyx in init h5py.h5()

**AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'**

I tried conda uninstall tensorflow,conda uninstall h5py and reinstall but still have this error. how can i fix this?



Solution 1:[1]

Uninstall h5py package a few times and then reinstall it again.

pip uninstall h5py
pip install h5py

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tensorflow Support