federated icon indicating copy to clipboard operation
federated copied to clipboard

Tutorial import problems - building_your_own_federated_learning_algorithm.ipynb

Open AntonKimfors opened this issue 3 years ago • 2 comments

I'm following the guide at https://www.tensorflow.org/federated/tutorials/building_your_own_federated_learning_algorithm and I'm doing it through Google Collab. The problems starts immediately when I run the first code block:

#@test {"skip": true}
!pip install --quiet --upgrade tensorflow-federated-nightly
!pip install --quiet --upgrade nest-asyncio

import nest_asyncio
nest_asyncio.apply()

I get the error code:

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. yellowbrick 1.3.post1 requires numpy<1.20,>=1.16.0, but you have numpy 1.21.5 which is incompatible. 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.

If I try to run the second code block, I get an error immediately on on the first row import tensorflow as tf

Error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-8d5e013f6c62> in <module>()
----> 1 import tensorflow as tf
      2 import tensorflow_federated as tff

3 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/client/pywrap_tf_session.py in <module>()
     17 # pylint: disable=invalid-import-order,g-bad-import-order, wildcard-import, unused-import
     18 from tensorflow.python import pywrap_tensorflow
---> 19 from tensorflow.python.client._pywrap_tf_session import *
     20 from tensorflow.python.client._pywrap_tf_session import _TF_SetTarget
     21 from tensorflow.python.client._pywrap_tf_session import _TF_SetConfig

ImportError: SystemError: <built-in method __contains__ of dict object at 0x7f52728e10a0> returned a result with an error set

How do I solve this? I tried some different things but didn't find anything that solved it for me... :/

AntonKimfors avatar Feb 02 '22 17:02 AntonKimfors

I can't reproduce the issue error. Have you tried "Runtime - Restart runtime"?

wennanzhu avatar Feb 14 '22 17:02 wennanzhu

Hi @AntonKimfors. This should have been fixed by commit 77d849c7c49f99a824f757719d8a8ebb4bf31953, which makes the tutorial rely on the latest release of TFF, not the nightly package. Please ping this thread if you are still having an issue.

zcharles8 avatar Feb 23 '22 23:02 zcharles8