Can't import tensorflow_federated

142 views Asked by At

An attribute Error raised when importing tensorflow_federated on colab though I did install it.

!pip install --quiet --upgrade tensorflow-federated

import tensorflow as tf

import tensorflow_federated as tff

--> import tensorflow_federated as tff : AttributeError: module 'numpy' has no attribute '_no_nep50_warning'

how can I solve it? Thank you!

!pip install --quiet --upgrade tensorflow-federated

import tensorflow as tf

import tensorflow_federated as tff

1

There are 1 answers

0
Priya T On

The error you're seeing,

import tensorflow_federated as tff : AttributeError: module 'numpy' has no attribute '_no_nep50_warning'

which mentions "module 'numpy' has no attribute '_no_nep50_warning'," is likely due to a compatibility issue between the versions of NumPy and TensorFlow Federated (TFF). To resolve this, you can follow a few steps.

1.Update the Numpy (Make sure you have the latest version of NumPy installed)

!pip install --upgrade numpy

2.Reinstall TensorFlow Federated:

!pip uninstall -y tensorflow-federated

!pip install tensorflow-federated

3.Import TensorFlow Federated:

import tensorflow_federated as tff

You can refer to the gist as given:- here