【发布时间】:2019-06-17 17:27:11
【问题描述】:
我正在尝试使用 pip 在我的 Windows 机器上安装 tensorflow 2.0 beta。我正在使用 requirements.txt 来自 https://github.com/ageron/handson-ml2/blob/master/requirements.txt
我所做的唯一更改是使用 beta tensorflow 版本而不是 tf-nightly-preview 版本。
#tf-nightly-2.0-preview#tf-nightly-gpu-2.0-previewtensorflow-gpu==2.0.0-beta1
我收到三个错误 -
ERROR: tensorflow-gpu 2.0.0b1 has requirement tb-nightly<1.14.0a20190604,>=1.14.0a20190603, but you'll have tb-nightly 1.15.0a20190617 which is incompatible.
ERROR: tfp-nightly 0.8.0.dev20190617 has requirement cloudpickle==1.1.1, but you'll have cloudpickle 1.2.1 which is incompatible.
最后一个
ERROR: Complete output from command 'D:\Data\Study\4hml\handson-ml2\env\Scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Vidya\\AppData\\Local\\Temp\\pip-install-hsmwtwf3\\cityhash\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Vidya\AppData\Local\Temp\pip-record-05j38rg_\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Data\Study\4hml\handson-ml2\env\include\site\python3.7\cityhash':
ERROR: running install
running build
running build_ext
building 'cityhash' extension
creating build
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Iinclude -ID:\Data\Study\4hml\handson-ml2\env\include "-ID:\Program Files\Python37\include" "-ID:\Program Files\Python37\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\ATLMFC\include" "-ID:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.21.27702\include" "-ID:\Windows Kits\10\include\10.0.17763.0\ucrt" "-ID:\Windows Kits\10\include\10.0.17763.0\shared" "-ID:\Windows Kits\10\include\10.0.17763.0\um" "-ID:\Windows Kits\10\include\10.0.17763.0\winrt" "-ID:\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tpsrc/city.cc /Fobuild\temp.win-amd64-3.7\Release\src/city.obj -O3 -Wno-unused-value -Wno-unused-function
cl : Command line error D8021 : invalid numeric argument '/Wno-unused-value'
error: command 'D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.21.27702\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command "'D:\Data\Study\4hml\handson-ml2\env\Scripts\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Vidya\\AppData\\Local\\Temp\\pip-install-hsmwtwf3\\cityhash\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Vidya\AppData\Local\Temp\pip-record-05j38rg_\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\Data\Study\4hml\handson-ml2\env\include\site\python3.7\cityhash'" failed with error code 1 in C:\Users\Vidya\AppData\Local\Temp\pip-install-hsmwtwf3\cityhash\
我已经安装了以下
- Python 3.7.3
- Visual Studio 社区版 2019
- CUDA 工具包/cuDNN sdk/CUPTI (我运行了 CUDA 安装示例解决方案 - deviceQuery 和 bandwidthTest,它们正常工作)
- 张量 RT 5.0 (sampleMNIST 解决方案也没有问题)
我升级了 pip(19.1.1 版)
setuptools(版本 41.0.1)
virtualenv(版本 16.6.1)
然后创建一个虚拟环境,激活它然后运行
python -m pip install --upgrade -r requirements.txt
我需要降级我的 python 版本吗? tensorflow 2.0 Beta 不适用于 python 3.7.3 吗?
对于来自 windows 的 cl 错误
cl : Command line error D8021 : invalid numeric argument '/Wno-unused-value
所有迹象都表明这是一个 gcc 标志,但我不知道如何删除它以及从设置中删除它的位置。
【问题讨论】:
-
github.com/tensorflow/community/blob/master/sigs/testing/faq.md 显示“将为 TensorFlow 2.0 添加对 Python 3.5 和 3.7 的支持。”
-
用 python 3.6 试过 - 我得到同样的 3 个错误!使用 tensorflow 的 beta 版本和 tensorflow 的 nightly-gpu-preview 版本。
-
您似乎有版本不兼容问题需要解决。我已经在 python 3.7 上运行了 TF 2.0 beta,但没有与 TF 1 同时运行。您是否已经在尝试安装 TF 2.0 的地方运行了 TF 1?
-
我还没有 TF1。对于 cityhash 问题,我在 github 中创建了一个问题,看起来他们可能会使用替代库。链接是 github.com/tensorflow/datasets/issues/690。但是,其他两个错误仍然存在。你有windows机器吗?我也在 google colab 中尝试过这个设置 - cloudpickle 和 tbnightly 存在相同的两个错误。
-
对于 cityhash 问题 - 解决方案是在库本身中交换 siphash。 (Github 链接 - github.com/tensorflow/datasets/issues/690)然而,在撰写本文时,我注意到它尚未从所需的包中删除。对于 tb-nightly 问题 - 可以安装 tb_nightly==1.14.0a20190614 而不仅仅是 tb-nightly。 cloudpickle 问题是由于两个包(scikit-image 和 tfp-nightly)相互冲突,都需要两个不同版本的 cloudpickle。
标签: python-3.x tensorflow tensorflow2.0