【问题标题】:Installation errors in Tensorflow Federated tutorial in Google ColabGoogle Colab 中 Tensorflow Federated 教程中的安装错误
【发布时间】:2021-07-14 15:14:58
【问题描述】:

我是联邦学习的新手。我尝试从 Colab 上的 tutorial“Federated Learning for Image Classification”开始,但遇到了一些问题。当我安装了 TensorFlow 和 TensorFlow Federated,

#@test {"skip": true}

# tensorflow_federated_nightly also bring in tf_nightly, which
# can causes a duplicate tensorboard install, leading to errors.
!pip uninstall --yes tensorboard tb-nightly

!pip install --quiet --upgrade tensorflow-federated-nightly
!pip install --quiet --upgrade nest-asyncio
!pip install --quiet --upgrade tb-nightly  # or tensorboard, but not both

import nest_asyncio
nest_asyncio.apply()

发生了一些错误

ERROR: tensorflow 2.5.0 requires tensorboard~=2.5, which is not installed.
ERROR: tensorflow 2.5.0 has requirement grpcio~=1.34.0, but you'll have grpcio 1.37.1 which is incompatible.
ERROR: tensorflow 2.5.0 has requirement keras-nightly~=2.5.0.dev, but you'll have keras-nightly 2.7.0.dev2021071300 which is incompatible.
ERROR: spacy 2.2.4 has requirement tqdm<5.0.0,>=4.38.0, but you'll have tqdm 4.28.1 which is incompatible.
ERROR: pymc3 3.11.2 has requirement cachetools>=4.2.1, but you'll have cachetools 3.1.1 which is incompatible.
ERROR: fbprophet 0.7.1 has requirement tqdm>=4.36.1, but you'll have tqdm 4.28.1 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.
ERROR: tensorflow-privacy 0.6.1 has requirement attrs>=21.2.0, but you'll have attrs 19.3.0 which is incompatible.

我看到一些关于这些错误的类似question,然后运行其余单元格。但是,当涉及到代码时

import collections

import numpy as np
import tensorflow as tf
import tensorflow_federated as tff

错误再次出现:

ImportError                               Traceback (most recent call last) <ipython-input-3-a23308ec3f7c> in <module>()
3 import numpy as np
4 import tensorflow as tf
----> 5 import tensorflow_federated as tff
  6 
  7 np.random.seed(0)

28 frames
/usr/local/lib/python3.7/dist-packages/keras/api/_v2/keras/__init__.py in <module>()
  8 import sys as _sys
  9 
---> 10 from keras import __version__
 11 from keras.api._v2.keras import __internal__
 12 from keras.api._v2.keras import activations

ImportError: cannot import name '__version__' from 'keras' (/usr/local/lib/python3.7/dist-packages/keras/__init__.py)

我不熟悉 TensorFlow Federated。有没有其他人遇到过同样的问题?需要指针来解决这个问题。

【问题讨论】:

    标签: installation google-colaboratory tensorflow-federated


    【解决方案1】:

    从一个干净的运行时开始并添加一个包含以下内容的代码部分:

    !pip uninstall tensorflow keras -y
    

    在运行其他任何内容之前运行它,然后重新启动运行时。然后,您可以运行本教程的其余部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-29
      • 2021-05-18
      • 1970-01-01
      • 1970-01-01
      • 2022-07-20
      • 2020-02-20
      • 2020-11-18
      相关资源
      最近更新 更多