【发布时间】:2020-06-14 18:31:59
【问题描述】:
在过去一年左右的时间里,我有 problemshere、here 和 there 安装了 TensorFlow 2。所以我正在尝试 Miniconda。
我有一个 AMD Radeon hd 6670 和一个 AMD Radeon hd 6450。
我刚刚下载了 Miniconda 并制作了一个环境,并在 Windows 8.1 上的 Miniconda 提示符中执行了 pip install --upgrade tensorflow 并获得了 TensorFlow 2.2。
当我尝试导入 tensorflow 时,我得到下面的堆栈跟踪。
我确实下载了 Visual Studio 以获得最新的可再发行组件(我认为)。
似乎这发生在这条线附近:from tensorflow.python.pywrap_tensorflow_internal import *
编辑 1:我将这个 yaml 文件用于 python 3.6(另一个是 3.7),但它产生了 same 错误。
编辑 2:我升级到 Conda 4.8.3 和 Python 3.7(在 yaml 文件中)并得到了同样的错误。这是 pywrap internal 中显示问题的行:
line 28: _pywrap_tensorflow_internal = swig_import_helper()
在 swig 助手中:
fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
看起来它正在寻找自己? 有人知道吗?
编辑 3:This 看起来像同样的问题,但它已经过时了。 This 似乎与使用 2015 C++ 可再发行组件解决的问题相同。我确实安装了 2015 x64 和 2015-2019 x86。
编辑 4:尝试 3.5 得到子进程错误(请参见下文)。
编辑 5:尝试使用 3.7:conda install 'tensorflow=*=mkl*'(并且没有 yaml 文件)确实有效(3.6 没有 有效)。不幸的是,导入 tf2 仍然需要 10 秒!
搜索:-gpu swig_import_helper "Failed to load the native TensorFlow runtime" 结果大约有 3.6k 次点击,所以这是一个持续存在的问题。
编辑 5:安装 Keras 会出现 this 错误。尝试修复得到:AttributeError: module 'tensorflow' has no attribute 'compat'。所以TensorFlow不再工作了。
有没有人有一个稳定的可重复过程?我正在尝试使用来自Deep Learning with Python, Second Edition 的代码。
编辑 6:卸载 minconda 大约需要一个小时。安装新的蟒蛇工作正常。使用他们的yaml 文件可以很好地安装。但是导入 tensorflow 会出现 dll 加载错误。
编辑 7:尝试 Python 3.8 并使用虚拟环境要快得多。我可以安装 TensorFlow。但是使用它会得到:
ImportError: Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a directory that is named in your %PATH% environmen
t variable.
我确实安装了可再发行组件,并且 windows/system32 在路径上:
(handson-ml2) d:\ray\dev\mlbooks\handson-ml2>echo %PATH%
d:\pyvenvs\handson-ml2\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\j
avapath;c:\Rtools\bin;c:\Rtools\mingw_32\bin;C:\ProgramData\Oracle\Java\javapath
;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x8
6;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\Wi
ndowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Stati
c;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\AM
D\ATI.ACE\Core-Static;C:\gnuplot\bin;C:\Program Files\Git\cmd;C:\Program Files\C
alibre2\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Program Files\MySQL\MySQ
L Utilities 1.6\;C:\Program Files (x86)\Common Files\Acronis\VirtualFile\;C:\Pro
gram Files (x86)\Common Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Comm
on Files\Acronis\FileProtector\;C:\Program Files (x86)\Common Files\Acronis\File
Protector64\;C:\Program Files\nodejs\;C:\Program Files (x86)\Brackets\command;C:
\Program Files\Microsoft VS Code\bin;C:\Users\ray\AppData\Local\Programs\Python\
Launcher\;d:\bin;C:\Users\ray\AppData\Roaming\npm;C:\Users\ray\AppData\Local\ato
m\bin;C:\Program Files (x86)\FAHClient;x:\Program Files\Docker Toolbox
Some 建议将 dll 复制到 python 路径区域。
似乎在一夜之间变成了警告。现在我明白了:
(handson-ml2) d:\ray\dev\mlbooks\handson-ml2>py
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2020-06-25 13:53:13.746994: W tensorflow/stream_executor/platform/default/dso_lo
ader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64
_101.dll not found
2020-06-25 13:53:13.776619: I tensorflow/stream_executor/cuda/cudart_stub.cc:29]
Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Pip subprocess error:
ERROR: Could not find a version that satisfies the requirement bokeh>=2.0.0 (fro
m panel>=0.7.0->holoviews->-r D:\ray\dev\COVID-19\condaenv.tvdi0rp1.requirements
.txt (line 5)) (from versions: 0.2, 0.3, 0.4, 0.4.1, 0.4.4, 0.5.0, 0.5.1, 0.5.2,
0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.
10.0, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 0.12.6, 0.
12.7, 0.12.9, 0.12.10, 0.12.11, 0.12.13, 0.12.14, 0.12.15, 0.12.16, 0.13.0, 1.0.
0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.4, 1.4.0)
ERROR: No matching distribution found for bokeh>=2.0.0 (from panel>=0.7.0->holov
iews->-r D:\ray\dev\COVID-19\condaenv.tvdi0rp1.requirements.txt (line 5))
CondaEnvException: Pip failed
这是原始堆栈跟踪:
Traceback (most recent call last):
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "d:\miniconda3\envs\tf2\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "d:\miniconda3\envs\tf2\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "2.py", line 1, in <module>
import tensorflow as tf
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module>
from tensorflow.python import pywrap_tensorflow
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "d:\miniconda3\envs\tf2\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "d:\miniconda3\envs\tf2\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "d:\miniconda3\envs\tf2\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
【问题讨论】:
标签: python-3.x dll installation tensorflow2.0 miniconda