federated
federated copied to clipboard
TypeError: 'ABCMeta' object is not subscriptable
I get this error whenever I try to import tendorflow_federated, what could be the reason? I am working on google Colab.
I get the same error.
I am working on your example notebook within Colab the following command yields the error
import tensorflow_federated as tff
TypeError Traceback (most recent call last)
path
."""
43 py_typecheck.check_type(path, (str, os.PathLike))
TypeError: 'ABCMeta' object is not subscriptable
Yesterday the same command was working, My first guess was that this is due to changes made in other dependencies. As the update of the package fails aswell:
!pip install --quiet --upgrade tensorflow-federated
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. spacy 2.2.4 requires tqdm<5.0.0,>=4.38.0, but you have tqdm 4.28.1 which is incompatible. pymc3 3.11.4 requires cachetools>=4.2.1, but you have cachetools 3.1.1 which is incompatible. panel 0.12.1 requires tqdm>=4.48.0, but you have tqdm 4.28.1 which is incompatible. fbprophet 0.7.1 requires tqdm>=4.36.1, but you have tqdm 4.28.1 which is incompatible. datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible. albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible.
But in the file_utils.py, where the error occurs none of these dependencies is needed.
I think it's a compatibility problem with the new release, I installed the previous release tensorflow-federated==0.20.0 and things now seem to be fine, hope they fix this soon.
Cheers, works well as quick fix.
I get a similar error when working with Colab and trying to import tensorflow_federated. The difference is that I was using version 0.22.0 and it now says TypeError: 'type' object is not subscriptable
.
The suggestion by @ns-it works for me as well, perfect. Thank you! (just wrote my comment for the developers in hope they will fix it)
The root issue is that Google Colab is on python 3.8 and tensorflow-federated
is using python 3.9 API. Installing an older version of tensorflow-federated
or using a custom runtime in Google Colab could solve this issue.
The current version requires a downgrade of tensorflow and tensorflow-probability package:
!pip install --quiet tensorflow==2.8.0
!pip install --quiet tensorflow-probability==0.15.0
!pip install --quiet tensorflow-federated==0.20.0
I did this and i got an error name python not defined when i tried the statement in google colab import tensorflow_federated as tff How to fix this