Hi all
When I run this:
import collections
import numpy as np
import tensorflow as tf
import tensorflow_federated as tff
I get this:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-178f3cd2038b> in <module>()
3 import numpy as np
4 import tensorflow as tf
----> 5 import tensorflow_federated as tff
7 frames
/usr/local/lib/python3.7/dist-packages/tensorflow_federated/python/common_libs/structure.py in <module>()
263
264 def to_odict(struct: Struct,
--> 265 recursive: bool = False) -> collections.OrderedDict[str, Any]:
266 """Returns `struct` as an `OrderedDict`, if possible.
267
TypeError: 'type' object is not subscriptable
How do I fix it?
I also get an error prior to this error (in the previous cell on the colab) which may help fix the error above:
When I run this:
#@test {"skip": true}
!pip install --quiet --upgrade tensorflow-federated
!pip install --quiet --upgrade nest-asyncio
import nest_asyncio
nest_asyncio.apply()
I get this:
|████████████████████████████████| 866 kB 4.2 MB/s
|████████████████████████████████| 1.8 MB 20.1 MB/s
|████████████████████████████████| 121 kB 57.1 MB/s
|████████████████████████████████| 45 kB 3.6 MB/s
|████████████████████████████████| 53 kB 2.4 MB/s
|████████████████████████████████| 4.0 MB 18.5 MB/s
|████████████████████████████████| 65.1 MB 71 kB/s
|████████████████████████████████| 237 kB 34.8 MB/s
|████████████████████████████████| 287 kB 8.8 MB/s
|████████████████████████████████| 887 kB 40.9 MB/s
|████████████████████████████████| 596 kB 13.8 MB/s
|████████████████████████████████| 54 kB 2.2 MB/s
|████████████████████████████████| 462 kB 35.2 MB/s
|████████████████████████████████| 9.5 MB 31.6 MB/s
|████████████████████████████████| 25.9 MB 5.1 MB/s
|████████████████████████████████| 5.7 MB 20.9 MB/s
|████████████████████████████████| 4.2 MB 21.5 MB/s
|████████████████████████████████| 11.5 MB 27.3 MB/s
Building wheel for jax (setup.py) ... done
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.
Perhaps the two errors are related
Found a solution, try:
!pip install --quiet tensorflow-federated==0.20.0 # The latest version of tensorflow-federated is not working with the colab python version
!pip install --quiet --upgrade nest-asyncio
Got solution from:
“Cannot import library tensorflow_federated · Issue #2770 · tensorflow/federated · GitHub”