module 'tensorflow.python.util.dispatch' has no attribute 'add_fallback_dispatch_list' - tensorflow

I get the following error with the code import keras:
AttributeError: module 'tensorflow.python.util.dispatch' has no attribute 'add_fallback_dispatch_list'

Related

error from numpy when importing sk-kmeans

i am trying to import :
from sklearn.cluster import KMeans as sk_KMeans
but i get the following error:
AttributeError: module 'numpy' has no attribute 'float'
how do i fix this?

AttributeError: module 'numpy' has no attribute 'warnings'

from sklearn.preprocessing import PowerTransformer
pt = PowerTransformer(method='yeo-johnson',standardize=True)
X_train['feature']=pt.fit_transform(np.array(X_train['feature']).reshape(-1, 1))
#fit the model only on the train set and transform the test set
X_test['feature']=pt.transform(np.array(X_test['feature']).reshape(-1, 1))
getting below error
AttributeError: module 'numpy' has no attribute 'warnings'
working fine with numpy==1.23.4
giving error with numpy==1.24.0

AttributeError: module 'matplotlib.pyplot' has no attribute 'plotfile'

Hello sorry I am very new at Python and I cannot figure out what I am missing. I am trying to use plotfile, my code is
import matplotlib.pyplot as plt
plt.plotfile('somefile.dat',delimiter=' ', cols=(0, 1),
names=('A, 'B'), marker='o')
and gives me the following error
AttributeError: module 'matplotlib.pyplot' has no attribute 'plotfile'

AttributeError: module 'keras.utils.generic_utils' has no attribute 'to_snake_case'

I'm trying a small program to capture emotion from an image from here
error
LOCAL.ALL_OBJECTS[generic_utils.to_snake_case(key)] = value
AttributeError: module 'keras.utils.generic_utils' has no attribute 'to_snake_case'
Code.py
from fer import FER
import matplotlib.pyplot as plt
from tensorflow.keras.utils import to_snake_case
def emotionCapture():
img = plt.imread("happy.jpg")
detector = FER(mtcnn=True)
print(detector.detect_emotions(img))
plt.imshow(img)
predicted_emotion, score = detector.top_emotion(img)
print (predicted_emotion)
return predicted_emotion
emotionCapture()
Keras version 2.4.3
Tensorflow version 2.5.0
opencv-python version 4.5.2.52
After removing 'mtcnn=True' from detector = FER(mtcnn=True) the function worked.

Tensorflow: import init_ops and random_ops

I would like to create a custom initializer based on the code of tf.truncated_normal_initializer.
However, when I try to import init_ops and random_ops. I get the error:
AttributeError: 'module' object has no attribute 'ops'
to reproduce:
import tensorflow.python.ops.random_ops as random_ops
Oops, quite trivial. Issue solved with
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import init_ops