尝试使用 pip 在 windows 机器上的虚拟环境中安装 tensorflow gpu beta 2.0 时出现多个错误

Multiple errors when trying to install tensorflow gpu beta 2.0 in virtual env on a windows machine using pip

我正在尝试使用 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-preview
tensorflow-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\Studyhml\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\Studyhml\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 Studio19\Community\VC\Tools\MSVC.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Iinclude -ID:\Data\Studyhml\handson-ml2\env\include "-ID:\Program Files\Python37\include" "-ID:\Program Files\Python37\include" "-ID:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.21.27702\ATLMFC\include" "-ID:\Program Files (x86)\Microsoft Visual Studio19\Community\VC\Tools\MSVC.21.27702\include" "-ID:\Windows Kits\include.0.17763.0\ucrt" "-ID:\Windows Kits\include.0.17763.0\shared" "-ID:\Windows Kits\include.0.17763.0\um" "-ID:\Windows Kits\include.0.17763.0\winrt" "-ID:\Windows Kits\include.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\Studyhml\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\Studyhml\handson-ml2\env\include\site\python3.7\cityhash'" failed with error code 1 in C:\Users\Vidya\AppData\Local\Temp\pip-install-hsmwtwf3\cityhash\

我安装了以下软件

我升级了 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 标志,但我不知道如何删除它以及从设置中的何处删除它。

  1. 在 tfds 的较新提交中 - cityhash 库已与 siphash 交换。

  2. 对于 tensorflow,tb_nightly 依赖项预计会更新 mid-July 因此,如果在那之后安装 - 问题甚至可能不会出现。

  3. 由于两个包的cloudpickle版本不同需要升级其中一个或者降级另一个。

也许升级您的设置工具可以解决问题。

python -m pip install --upgrade setuptools==41.0.0