# Copyright 2015 The TensorFlow Authors. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ============================================================================== | |
"""A script for testing that TensorFlow is installed correctly on Windows. | |
The script will attempt to verify your TensorFlow installation, and print | |
suggestions for how to fix your installation. | |
""" | |
import ctypes | |
import imp | |
import sys | |
def main(): | |
try: | |
import tensorflow as tf | |
print("TensorFlow successfully installed.") | |
if tf.test.is_built_with_cuda(): | |
print("The installed version of TensorFlow includes GPU support.") | |
else: | |
print("The installed version of TensorFlow does not include GPU support.") | |
sys.exit(0) | |
except ImportError: | |
print("ERROR: Failed to import the TensorFlow module.") | |
print(""" | |
WARNING! This script is no longer maintained! | |
============================================= | |
Since TensorFlow 1.4, the self-check has been integrated with TensorFlow itself, | |
and any missing DLLs will be reported when you execute the `import tensorflow` | |
statement. The error messages printed below refer to TensorFlow 1.3 and earlier, | |
and are inaccurate for later versions of TensorFlow.""") | |
candidate_explanation = False | |
python_version = sys.version_info.major, sys.version_info.minor | |
print("\n- Python version is %d.%d." % python_version) | |
if not (python_version == (3, 5) or python_version == (3, 6)): | |
candidate_explanation = True | |
print("- The official distribution of TensorFlow for Windows requires " | |
"Python version 3.5 or 3.6.") | |
try: | |
_, pathname, _ = imp.find_module("tensorflow") | |
print("\n- TensorFlow is installed at: %s" % pathname) | |
except ImportError: | |
candidate_explanation = False | |
print(""" | |
- No module named TensorFlow is installed in this Python environment. You may | |
install it using the command `pip install tensorflow`.""") | |
try: | |
msvcp140 = ctypes.WinDLL("msvcp140.dll") | |
except OSError: | |
candidate_explanation = True | |
print(""" | |
- Could not load 'msvcp140.dll'. TensorFlow requires that this DLL be | |
installed in a directory that is named in your %PATH% environment | |
variable. You may install this DLL by downloading Microsoft Visual | |
C++ 2015 Redistributable Update 3 from this URL: | |
https://www.microsoft.com/en-us/download/details.aspx?id=53587""") | |
try: | |
cudart64_80 = ctypes.WinDLL("cudart64_80.dll") | |
except OSError: | |
candidate_explanation = True | |
print(""" | |
- Could not load 'cudart64_80.dll'. The GPU version of TensorFlow | |
requires that this DLL be installed in a directory that is named in | |
your %PATH% environment variable. Download and install CUDA 8.0 from | |
this URL: https://developer.nvidia.com/cuda-toolkit""") | |
try: | |
nvcuda = ctypes.WinDLL("nvcuda.dll") | |
except OSError: | |
candidate_explanation = True | |
print(""" | |
- Could not load 'nvcuda.dll'. The GPU version of TensorFlow requires that | |
this DLL be installed in a directory that is named in your %PATH% | |
environment variable. Typically it is installed in 'C:\Windows\System32'. | |
If it is not present, ensure that you have a CUDA-capable GPU with the | |
correct driver installed.""") | |
cudnn5_found = False | |
try: | |
cudnn5 = ctypes.WinDLL("cudnn64_5.dll") | |
cudnn5_found = True | |
except OSError: | |
candidate_explanation = True | |
print(""" | |
- Could not load 'cudnn64_5.dll'. The GPU version of TensorFlow | |
requires that this DLL be installed in a directory that is named in | |
your %PATH% environment variable. Note that installing cuDNN is a | |
separate step from installing CUDA, and it is often found in a | |
different directory from the CUDA DLLs. You may install the | |
necessary DLL by downloading cuDNN 5.1 from this URL: | |
https://developer.nvidia.com/cudnn""") | |
cudnn6_found = False | |
try: | |
cudnn = ctypes.WinDLL("cudnn64_6.dll") | |
cudnn6_found = True | |
except OSError: | |
candidate_explanation = True | |
if not cudnn5_found or not cudnn6_found: | |
print() | |
if not cudnn5_found and not cudnn6_found: | |
print("- Could not find cuDNN.") | |
elif not cudnn5_found: | |
print("- Could not find cuDNN 5.1.") | |
else: | |
print("- Could not find cuDNN 6.") | |
print(""" | |
The GPU version of TensorFlow requires that the correct cuDNN DLL be installed | |
in a directory that is named in your %PATH% environment variable. Note that | |
installing cuDNN is a separate step from installing CUDA, and it is often | |
found in a different directory from the CUDA DLLs. The correct version of | |
cuDNN depends on your version of TensorFlow: | |
* TensorFlow 1.2.1 or earlier requires cuDNN 5.1. ('cudnn64_5.dll') | |
* TensorFlow 1.3 or later requires cuDNN 6. ('cudnn64_6.dll') | |
You may install the necessary DLL by downloading cuDNN from this URL: | |
https://developer.nvidia.com/cudnn""") | |
if not candidate_explanation: | |
print(""" | |
- All required DLLs appear to be present. Please open an issue on the | |
TensorFlow GitHub page: https://github.com/tensorflow/tensorflow/issues""") | |
sys.exit(-1) | |
if __name__ == "__main__": | |
main() |
This comment has been minimized.
This comment has been minimized.
I am getting these error how can i fix them? C:\PythonPrograms>python tensorflow_self_check.py
I found the 'msvcp140.dll' in C drive and i pasted in python folder which is mention in path variable but still it gives me the same error. |
This comment has been minimized.
This comment has been minimized.
Thank you for this. |
This comment has been minimized.
This comment has been minimized.
Hello,@mrry.
|
This comment has been minimized.
This comment has been minimized.
@justprotato Pop this on Stack Overflow and I can probably help. I've been having these issues and think that I know what the issue is. Don't want to spam here though. |
This comment has been minimized.
This comment has been minimized.
Thank you, @jubjamie. I have posted in Stack Overflow |
This comment has been minimized.
This comment has been minimized.
That's a great script! |
This comment has been minimized.
This comment has been minimized.
Brilliant Script. |
This comment has been minimized.
This comment has been minimized.
Thank you very much! Brilliant. |
This comment has been minimized.
This comment has been minimized.
thank you glenlewis for pointing out the syntax error |
This comment has been minimized.
This comment has been minimized.
When running the script I get no output. When running it in PyCharm it says: "Process finished with exit code 0" but none of the print statements gets printed. Same when executing the script in cmd. |
This comment has been minimized.
This comment has been minimized.
Thank you for supplying this. I would never have found out that
Because unfortunately as of today (17th Aug 2017) https://www.tensorflow.org/install/install_windows was stating cuDNN v5.1 was required. I know you have saved me hours. |
This comment has been minimized.
This comment has been minimized.
Thank you so much! The official website of tensorflow is misleading, it says I need cuDNN5.1. After I run your test program, it says I need cuDNN6.0, then I fixed it! Thank you! |
This comment has been minimized.
This comment has been minimized.
Okay. Solved it. Same issue as TensorFlow 1.3 or later requires cuDNN 6. ('cudnn64_6.dll') |
This comment has been minimized.
This comment has been minimized.
@prdas31 thanks for sharing, you saved the day! |
This comment has been minimized.
This comment has been minimized.
It solves my problem not loading DLL after I switch cuDNN5.1 to cuDNN6.0. Thanks a lot! |
This comment has been minimized.
This comment has been minimized.
This really saved me. The install guide https://www.tensorflow.org/install/install_windows explicitly mentioned cuDNN v5.1. So I was really stuck until I ran this code. cuDNN v6.0 was all I needed. |
This comment has been minimized.
This comment has been minimized.
Thank you very much! This problem has already spend my two days. When the tensorflow version is 1.3, you must download cuDNN6!! But in the mainpage of tensorflow, It appears cuDNN5 still. |
This comment has been minimized.
This comment has been minimized.
This is superb, I had no idea I had to downgrade cuDNN from 7 to 6 before I ran this script. |
This comment has been minimized.
This comment has been minimized.
I spend all day fixing the "dll loaded failed" problem...And finally,resolve it according to This Script...HAHAHAH... |
This comment has been minimized.
This comment has been minimized.
Muito obrigado pelo script. |
This comment has been minimized.
This comment has been minimized.
Super helpful - thanks a ton! |
This comment has been minimized.
This comment has been minimized.
Really great function. It is super helpful. |
This comment has been minimized.
This comment has been minimized.
Thanks a lot! it is of great help |
This comment has been minimized.
This comment has been minimized.
Thanks a lot. Saved a lot of time |
This comment has been minimized.
This comment has been minimized.
Thank you very much! |
This comment has been minimized.
This comment has been minimized.
It is really helpful to me. |
This comment has been minimized.
This comment has been minimized.
Couldn't really run that code..it spat some error pointing to main.. |
This comment has been minimized.
This comment has been minimized.
Google should include this check into TensorFlow utility. Good job! |
This comment has been minimized.
This comment has been minimized.
Man i dont get what Im doing wrong here... this script runs then quickly closes! :/ |
This comment has been minimized.
This comment has been minimized.
There was an error and it was very troubled. Thank you. |
This comment has been minimized.
This comment has been minimized.
Hi, thanks a lot for this script. |
This comment has been minimized.
This comment has been minimized.
Thanks a lot! It would be great if the TF people would link to this script from their installation site -- would save some trouble. |
This comment has been minimized.
This comment has been minimized.
Thanks a lot! It helps me to check my installation |
This comment has been minimized.
This comment has been minimized.
Am not able to figure out whats wrong please help :/ #############################################################
|
This comment has been minimized.
This comment has been minimized.
@dikshantx It looks like you're not running on Windows. This script is only intended for dealing with Windows installation issues. |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Wow! So amazing! Thank you very much! |
This comment has been minimized.
This comment has been minimized.
Says its all good, I had to download a few of the cudnn version files until I finally got the correct one. |
This comment has been minimized.
This comment has been minimized.
Thank you, it seems very useful. I'm already applying the recommendations and waiting for tensorflow to work in my system. |
This comment has been minimized.
This comment has been minimized.
please note that tensorflow now seems to require cuda 9.0 and not 8.0 as required in your script. after uninstalling/reinstalling 8.0 to get your script working (which I appreciate the hardwork), I added the first import line from here: ...once you fix this updated requirement in the script, be sure to update the cuDNN file too. if not, you'll receive the following error: after you retrieve and install... it finally seems to work: |
This comment has been minimized.
This comment has been minimized.
again, very helpful script; awesome work.
Good Luck! Prediction is "Versicolor" (97.0%), expected "Versicolor" Prediction is "Virginica" (97.8%), expected "Virginica" |
This comment has been minimized.
This comment has been minimized.
Thank you! You saved my day. |
This comment has been minimized.
This comment has been minimized.
I've recently installed windows 10. I then installed python 3.5.2 and Tensorflow 1.6 but when I run the test script i get this error; C:\Users\Don>python
During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace ot this. Kindly help C:\Users\Don>python tensorflow_self_check.py
C:\Users\Don> I don't understand this as I'm using CPU version |
This comment has been minimized.
This comment has been minimized.
Seems tensorflow 1.6 is the issue, |
This comment has been minimized.
This comment has been minimized.
Just a note to anybody who is still using this script: since TF 1.4, the checks have been integrated into TensorFlow when you |
This comment has been minimized.
This comment has been minimized.
I'm getting installation errors for tensorflow CPU version, will this help me to troubleshoot the problems. |
This comment has been minimized.
This comment has been minimized.
this script is asking for graphics files while I am using CPU version only |
This comment has been minimized.
This comment has been minimized.
It seems there is the problem with the newer windows CPU version (1.6 onwards ) of tensorflow. |
This comment has been minimized.
This comment has been minimized.
I faced a similar problem using a Paperspace Windows 10 virtual machine. Reverting to tensorflow 1.5 helped. |
This comment has been minimized.
This comment has been minimized.
thanks pyparam!! i downgrade the tensorflow versions from 1.8 to 1.5 and it worked for me. |
This comment has been minimized.
This comment has been minimized.
I have an error when I run in a cluster Failed to load the native TensorFlow runtime. even I have no error and no pm when I run suggested script! (https://gist.github.com/mrry/ee5dbcfdd045fa48a27d56664411d41c) |
This comment has been minimized.
This comment has been minimized.
With 1.11.0, my error is AttributeError: module '_pywrap_tensorflow_internal' has no attribute 'TFE_DEVICE_PLACEMENT_EXPLICIT_swigconstant' which appears whenever you do import tensorflow as tf. So with this script the full stack trace is: Traceback (most recent call last): EDIT |
This comment has been minimized.
This comment has been minimized.
man you are rock! |
This comment has been minimized.
This comment has been minimized.
Thanks a lot |
This comment has been minimized.
This comment has been minimized.
win server2008 r2 64位 python3.5.2 set up tensorflow1.12.0 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Using TensorFlow backend. ERROR:root:Internal Python error in the inspect module. Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): 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 During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): 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 During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): 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 During handling of the above exception, another exception occurred: Traceback (most recent call last): 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 During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): 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 During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): 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 ImportError Traceback (most recent call last) c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py in c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py in swig_import_helper() c:\users\lenovo\appdata\local\programs\python\python36\lib\imp.py in load_module(name, file, filename, details) c:\users\lenovo\appdata\local\programs\python\python36\lib\imp.py in load_dynamic(name, path, file) ImportError: DLL load failed: The specified module could not be found. During handling of the above exception, another exception occurred: During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) AttributeError: 'ImportError' object has no attribute 'render_traceback' During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\IPython\core\interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code) c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context) c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context) c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\IPython\core\ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context) TypeError: must be str, not list hey there, |
This comment has been minimized.
This comment has been minimized.
I don't have tensorflow_self_check.py file |
This comment has been minimized.
Thanks a lot dude.
I was trying to troubleshoot tensorflow-gpu install with cuda on windows 10 for weeks!!!
This really helped me!
Thanks again !