Search code examples
pythontensorflowtensorflow-federated

What version of Tensorflow federated has the module 'federated_computation'?


I am trying to install Tensorflow federated on google collab, but there is a conflict with versions, I either get this error if I install previous versions or similar errors.

module tensorflow_federated.python has no attribute federated_computation

If I want to install the new version it gives the "this requires this version but you have this version" during the installation. I am very confused. Is there an easy way to use Tensorflow federated learning? I tried to install it locally but that also didn't work. Why is it so hard to use it?

enter image description here

enter image description here

If I uninstalled all packages and installed them again it gives me the error mentioned above

If I try to import it ignoring the errors in the pictures it gives me this error with a newer version

'type' object is not subscribable

And this error with version 20

module 'tensorflow_federated.python' has no attribute 'federated_computation'

Solution

  • The problem was that

    1. you need to install Tensorflow federated learning version 0.20.0
    !pip install --quiet tensorflow-federated==0.20.0
    
    1. Ignore the dependency error
    2. Instead of the below
    from tensorflow_federated import python as tff
    

    use:

    import tensorflow_federated as tff