【发布时间】:2021-12-26 20:07:30
【问题描述】:
我在尝试使用 tensorflow 时遇到了一些 reticulate 问题。如果我在 CLI 上运行纯 R 会话或纯 Python 会话,我就可以安装和使用 tensorflow。
library(reticulate) # loads fine
conda_create("r-reticulate") # seems to work
conda_install("r-reticulate", "scipy") # seems to work
conda_install("r-reticulate", "tensorflow") # fails
# Collecting package metadata (current_repodata.json): ...working... done # Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve. # Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source. # # ResolvePackageNotFound: # - python=3.1 # # Error: one or more Python packages failed to install [error code 1]
不知道是怎么回事,那我试试
use_condaenv("r-reticulate") # seems to work
py_install("tensorflow") # fails
给出错误:
错误:找不到 Python 环境 /opt/local/bin/python3.9
然后我尝试了:
virtualenv_create("rstudio-python-virtualenv")
引发错误
错误:清理 numpy 的构建目录失败
虽然失败了,但我尝试过只是为了一笑而过
virtualenv_install("rstudio-python-virtualenv", "tensorflow")
抛出
错误:找不到满足要求的版本 tensorflow(来自版本:无)
经过更多故障排除后,我尝试将“全局选项”中指定的 Python 解释器更改为上面创建的这两个新虚拟环境。它对错误消息没有影响。
我还尝试了reticulate::py_install("tensorflow"),它会抛出:
Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve. Solving environment: ...working... failed with repodata from current_repodata.json, will retry with next repodata source. ResolvePackageNotFound: - python=3.1 Error: one or more Python packages failed to install [error code 1] >
【问题讨论】:
-
我曾经在使用 conda 时遇到过很多麻烦,您是否尝试过使用普通的全新 python 安装,并将其设置为具有网状的默认环境?
-
@bricx 很有趣。好吧,我已经尝试过已经安装在我的系统上的 Python 3.7 和 3.9,然后我进行了全新的 conda 安装,它安装了 3.10。根据我看到的依赖冲突,对于 tensorflow 的 conda 版本来说,3.10 可能太新了,所以我将尝试使用 3.6。
标签: python r tensorflow virtualenv reticulate