TensorFlow WHL文件为什么不包含所有必需的依赖项?

时间:2019-07-17 20:13:12

标签: python tensorflow installation

系统:Windows 10 64位,python 3.6.5 64位。使用水蟒。 CUDA 10.0,已安装cuddn。

美好的一天。出于安全原因,我们公司拒绝访问Internet。我从TF tensorFlow官方网站下载了软件包:

https: //storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.14.0-cp36-cp36m-win_amd64.whl

我尝试使用pip安装它:

pip install --upgrade D:\tensorflow_gpu-1.14.0-cp36-cp36m-win_amd64.whl

我收到以下消息:

collecting keras-preprocessing>=1.0.5 (from tensorflow-gpu==1.14.0)
Retrying ....after connection broken by 'NewConnectionError'
......
could not find a version that satifies the requirement keras-preprocessing=>1.0.5.....
no matching distribution found for keras-preprocessing=>1.0.5 (from tensorflow-gpu==1.14.0)

重新启动时,找不到其他一些TensorFlow依赖项,据我了解,pip根本看不到任何依赖项

我认为WHL软件包具有所有必要的依赖性,但是在安装pip时,它将尝试从Internet下载某些内容。告诉我我在做什么错了吗?

pip检查tensorflow结果:

(base) C:\Windows\system32>pip check tensorflow

tensorflow 1.10.0 requires absl-py, which is not installed.
tensorflow 1.10.0 requires astor, which is not installed.
tensorflow 1.10.0 requires gast, which is not installed.
tensorflow 1.10.0 requires grpcio, which is not installed.
tensorflow 1.10.0 requires protobuf, which is not installed.
tensorflow 1.10.0 requires tensorboard, which is not installed.
tensorflow 1.10.0 requires termcolor, which is not installed.
tensorflow-gpu 1.14.0 requires absl-py, which is not installed.
tensorflow-gpu 1.14.0 requires astor, which is not installed.
tensorflow-gpu 1.14.0 requires gast, which is not installed.
tensorflow-gpu 1.14.0 requires google-pasta, which is not installed.
tensorflow-gpu 1.14.0 requires grpcio, which is not installed.
tensorflow-gpu 1.14.0 requires keras-applications, which is not installed.
tensorflow-gpu 1.14.0 requires keras-preprocessing, which is not installed.
tensorflow-gpu 1.14.0 requires protobuf, which is not installed.
tensorflow-gpu 1.14.0 requires tensorboard, which is not installed.
tensorflow-gpu 1.14.0 requires tensorflow-estimator, which is not installed.
tensorflow-gpu 1.14.0 requires termcolor, which is not installed.
distributed 1.21.8 requires msgpack, which is not installed.
tensorflow-gpu 1.14.0 has requirement numpy<2.0,>=1.14.5, but you have numpy 1.14.3.
tensorflow-gpu 1.14.0 has requirement wrapt>=1.11.1, but you have wrapt 1.10.11.

1 个答案:

答案 0 :(得分:1)

  

我认为WHL软件包具有所有必要的依赖关系

不。车轮不包含所有依赖关系,也不应该包含所有依赖关系,否则每个车轮都会极度膨胀。如果必须在无法访问互联网的计算机上安装tensorflow-gpu(或其他轮子),请执行以下步骤:

  1. 在具有互联网访问权限的计算机上,运行:

    \> pip download tensorflow-gpu --dest some\dir
    

    (您可以通过运行包含包含已下载的--dest的目录作为tensorflow_gpu-1.14.0-cp36-cp36m-win_amd64.whl来运行此命令,因此不必再次下载它)

    这将下载tensorflow-gpu及其所有依赖项树。

  2. 现在将目录(包含所有下载的文件)传输到计算机上 ,而无需访问Internet并运行:

    \> pip install tensorflow-gpu --no-index --find-links some\dir
    

    --no-index将指示pip不要在线查找软件包,--find-links将指向本地目录,可以在其中找到要安装的软件包。