【问题标题】:install_keras() in RStudio, tensorflow 2.4.0 requires gast==0.3.3, but you have gast 0.4.0 which is incompatibleRStudio 中的 install_keras(),tensorflow 2.4.0 需要 gast==0.3.3,但是你有 gast 0.4.0,这是不兼容的
【发布时间】:2021-05-27 11:55:30
【问题描述】:

我正在尝试使用 RStudio 中的 keras 库来使用 keras_model_sequential() 函数,但无法克服以下错误:

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.
tensorflow 2.4.0 requires gast==0.3.3, but you have gast 0.4.0 which is incompatible.
tensorflow 2.4.0 requires grpcio~=1.32.0, but you have grpcio 1.38.0 which is incompatible.
tensorflow 2.4.0 requires h5py~=2.10.0, but you have h5py 3.1.0 which is incompatible.

当我在终端安装错误消息中建议的版本时,我得到了同样的错误:

(env) (base) ➜  env pip install gast==0.3.3
Collecting gast==0.3.3
  Using cached gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Installing collected packages: gast
  Attempting uninstall: gast
    Found existing installation: gast 0.4.0
    Uninstalling gast-0.4.0:
      Successfully uninstalled gast-0.4.0
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.
tensorflow 2.5.0 requires gast==0.4.0, but you have gast 0.3.3 which is incompatible.

有人有这方面的经验吗?非常感谢任何形式的帮助!

【问题讨论】:

    标签: r tensorflow keras


    【解决方案1】:

    我认为这已在更新版本的 keras/tensorflow 中得到解决。在大多数情况下,这应该有效:

    install.packages("keras")
    reticulate::install_miniconda()
    keras::install_keras()
    

    如果您尝试重用具有某些冲突依赖项的先前 python 环境(可能是您观察到的错误消息的原因),您可以通过传递 pip_ignore_installed = TRUE 临时解决其中的大部分问题:

    keras::install_keras(pip_ignore_installed = TRUE)
    

    【讨论】:

      猜你喜欢
      • 2021-12-29
      • 2023-03-07
      • 2021-12-05
      • 2023-03-27
      • 2021-05-18
      • 2022-12-19
      • 2022-01-27
      • 2019-03-04
      • 2022-06-21
      相关资源
      最近更新 更多