为什么 Anaconda 对带 GPU 和不带 GPU 的 Tensorflow 有单独的包,我应该使用 conda 还是 pip?
Why Anaconda has separate packages for Tensorflow with and without GPU, and should I use conda or pip?
Anaconda 有不同的 Tensorflow 包,有和没有 GPU 支持。
特别是,要使用 GPU 安装 Tensorflow,您应该 运行:
conda install tensorflow-gpu
非GPU版本需要安装:
conda install tensorflow
通过查看安装包的版本,conda安装的是Tensorflow 2.1版本。
但是截至今天,Tensorflow 的最新版本是 2.3。此外,在Tensorflow officla documentation中可以看到,最新版本可以用
安装
pip install tensorflow
文档中说此包适用于 CPU 和 GPU 版本的 Tensorflow。此外,文档指出 CPU 和 GPU 的包对于“1.15 及更早版本”是不同的。
为什么 Anaconda 在两个不同的包中提供 2.1,因为任何版本 > 1.15 的包都应该相同?
我应该安装哪个,pip版本还是conda版本? Anaconda blog中的一篇文章指出conda提供的版本速度更快,但是文章是旧的(2018)并且参考了旧版本的Tensorflow(1.10)
如果你使用的是Anaconda,那么你可以使用conda来安装tensorflow。对于 cpu 版本,输入
conda install tensorflow
for the gpu version enter
conda install tensorflow-gpu.
如果您使用 Windows,它将安装版本 2.1.0、cuda 工具包版本 10.1.243 和 cudnn 版本 7.6.5。注意 conda 只能在 Windows 操作系统上安装最高版本 2.1.0 的 tensorflow。如果您想要 tensorflow 2.2.0 或 2.3.0,请在安装 2.1 后使用 pip 安装它。 cuda 工具包和 cudnn 适用于 2.2 和 2.3 版本。另一件事。使用 python3.7 而不是 3.8。显然,当您使用 conda 安装 tensorflow 时,它不适用于 3.8。
如果您使用 pip 安装 tensorflow 2.1 或更高版本,它包括 cpu 和 gpu 版本,但是您必须通过手动过程来安装 Cuda Toolkit 和 cudnn。这包括从 NVIDIA 下载文件。您还必须更改 PATH 环境变量。
By checking the version of the installed package, conda installs Tensorflow version 2.1.
But as of today the latest version of Tensorflow is 2.3. Furthermore
那只是因为您(可能?)在 windows。如您所见,here tensorflow
在 conda
默认频道中以 2.3 的形式提供,但目前仅在 linux.
上可用
原因在你的网站上也有说明linked(强调我的):
Anaconda is proud of our efforts to deliver a simpler, faster experience using the excellent TensorFlow library. It takes significant time and effort to add support for the many platforms used in production, and to ensure that the accelerated code is still stable and mathematically correct. As a result, our TensorFlow packages may not be available concurrently with the official TensorFlow wheels. We are, however, committed to maintaining our TensorFlow packages, and work to have updates available as soon as we can.
简而言之:Anaconda 团队正在针对英特尔 mkl 库创建 tf 的自定义构建,以加速 CPU 上的计算。在同一网站的早些时候,他们还提到他们为不同的 cuda 版本创建构建。
Why Anaconda provides 2.1 in two different packages, given that the package should be the same for any version > 1.15?
tensorflow-gpu
包只是一个元包,即它仅用于安装具有不同依赖项的 tensorflow
的不同构建(也使您能够安装不同的 cuda 版本)。官方发布只允许 combinations tensorflow 版本和 cuda.
Which one should I install, the pip version or the conda version? An article in Anaconda blog specifies that the version provided with conda is faster, but the article is old (2018) and refers to an old version of Tensorflow (1.10)
阅读上述文章,加速与针对英特尔 mkl 库的构建相关联,它加速了 CPU 上的计算。鉴于您的设置,您只能在使用 conda
时安装 tensorflow
2.1,您需要问问自己是否依赖最新的 tensorflow
版本,如果不需要加速 cpu 代码。使用 pip
安装最新的 tensorflow 通常没有问题。只需确保为所述 tensorflow 版本创建一个新环境,并且仅 install/update tensorflow 或其任何依赖项在该环境中使用 pip
。 general advice 不要 mix conda
和 pip
安装太多,因为一个可能会破坏另一个(因为他们使用不同的方法来解决依赖项),但是使用单独的 env
时应该没问题
Anaconda 有不同的 Tensorflow 包,有和没有 GPU 支持。
特别是,要使用 GPU 安装 Tensorflow,您应该 运行:
conda install tensorflow-gpu
非GPU版本需要安装:
conda install tensorflow
通过查看安装包的版本,conda安装的是Tensorflow 2.1版本。
但是截至今天,Tensorflow 的最新版本是 2.3。此外,在Tensorflow officla documentation中可以看到,最新版本可以用
安装pip install tensorflow
文档中说此包适用于 CPU 和 GPU 版本的 Tensorflow。此外,文档指出 CPU 和 GPU 的包对于“1.15 及更早版本”是不同的。
为什么 Anaconda 在两个不同的包中提供 2.1,因为任何版本 > 1.15 的包都应该相同?
我应该安装哪个,pip版本还是conda版本? Anaconda blog中的一篇文章指出conda提供的版本速度更快,但是文章是旧的(2018)并且参考了旧版本的Tensorflow(1.10)
如果你使用的是Anaconda,那么你可以使用conda来安装tensorflow。对于 cpu 版本,输入
conda install tensorflow
for the gpu version enter
conda install tensorflow-gpu.
如果您使用 Windows,它将安装版本 2.1.0、cuda 工具包版本 10.1.243 和 cudnn 版本 7.6.5。注意 conda 只能在 Windows 操作系统上安装最高版本 2.1.0 的 tensorflow。如果您想要 tensorflow 2.2.0 或 2.3.0,请在安装 2.1 后使用 pip 安装它。 cuda 工具包和 cudnn 适用于 2.2 和 2.3 版本。另一件事。使用 python3.7 而不是 3.8。显然,当您使用 conda 安装 tensorflow 时,它不适用于 3.8。 如果您使用 pip 安装 tensorflow 2.1 或更高版本,它包括 cpu 和 gpu 版本,但是您必须通过手动过程来安装 Cuda Toolkit 和 cudnn。这包括从 NVIDIA 下载文件。您还必须更改 PATH 环境变量。
By checking the version of the installed package, conda installs Tensorflow version 2.1. But as of today the latest version of Tensorflow is 2.3. Furthermore
那只是因为您(可能?)在 windows。如您所见,here tensorflow
在 conda
默认频道中以 2.3 的形式提供,但目前仅在 linux.
原因在你的网站上也有说明linked(强调我的):
Anaconda is proud of our efforts to deliver a simpler, faster experience using the excellent TensorFlow library. It takes significant time and effort to add support for the many platforms used in production, and to ensure that the accelerated code is still stable and mathematically correct. As a result, our TensorFlow packages may not be available concurrently with the official TensorFlow wheels. We are, however, committed to maintaining our TensorFlow packages, and work to have updates available as soon as we can.
简而言之:Anaconda 团队正在针对英特尔 mkl 库创建 tf 的自定义构建,以加速 CPU 上的计算。在同一网站的早些时候,他们还提到他们为不同的 cuda 版本创建构建。
Why Anaconda provides 2.1 in two different packages, given that the package should be the same for any version > 1.15?
tensorflow-gpu
包只是一个元包,即它仅用于安装具有不同依赖项的 tensorflow
的不同构建(也使您能够安装不同的 cuda 版本)。官方发布只允许 combinations tensorflow 版本和 cuda.
Which one should I install, the pip version or the conda version? An article in Anaconda blog specifies that the version provided with conda is faster, but the article is old (2018) and refers to an old version of Tensorflow (1.10)
阅读上述文章,加速与针对英特尔 mkl 库的构建相关联,它加速了 CPU 上的计算。鉴于您的设置,您只能在使用 conda
时安装 tensorflow
2.1,您需要问问自己是否依赖最新的 tensorflow
版本,如果不需要加速 cpu 代码。使用 pip
安装最新的 tensorflow 通常没有问题。只需确保为所述 tensorflow 版本创建一个新环境,并且仅 install/update tensorflow 或其任何依赖项在该环境中使用 pip
。 general advice 不要 mix conda
和 pip
安装太多,因为一个可能会破坏另一个(因为他们使用不同的方法来解决依赖项),但是使用单独的 env