尝试使用pip

时间:2019-06-17 17:27:11

标签: python-3.x tensorflow tensorflow2.0

我正在尝试使用pip在Windows机器上安装tensorflow 2.0 beta。我正在使用来自的 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\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和widthTest,它们可以正常工作)
  • Tensor RT 5.0 (sampleMNIST解决方案也没有问题)

我升级了 pip (版本19.1.1)

设置工具(版本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标志,但我不知道如何删除它以及在哪里从设置中删除它。

2 个答案:

答案 0 :(得分:0)

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

  2. 对于tensorflow,预计tb_nightly依赖项将在7月中旬更新,因此如果在此之后安装-该问题甚至可能不会出现。

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

答案 1 :(得分:0)

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

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