OS:Windows 10
Python ver.:Python 2.7.13
tensorflow ver.:1.0.1
CUDA:v8.0
cudnn:v5.1
I have already set my CUDA and cudnn well.
cudnn64_5.dll is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
cudnn.h is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include
cudnn.lib is in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
and added path:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
Microsoft Visual C++ 2015 Redistributable(x64) is also installed.
but still got this error:
Traceback (most recent call last):
File "keras_test.py", line 2, in <module>
from keras import*
File "C:\Python27\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Python27\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Python27\lib\site-packages\keras\utils\conv_utils.py", line 3, in <module>
from .. import backend as K
File "C:\Python27\lib\site-packages\keras\backend\__init__.py", line 83, in <module>
from .tensorflow_backend import *
File "C:\Python27\lib\site-packages\keras\backend\tensorflow_backend.py", line 1, in <module>
import tensorflow as tf
File "C:\Python27\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
import _pywrap_tensorflow
ImportError: No module named _pywrap_tensorflow
Failed to load the native TensorFlow runtime.
I found that there is very little information about tensorflow for python2.7 on Windows.
Is there any other solution?
Or should I switch to python 3.5.x on Windows?
Or use python2.7 on Linux?
From the docs:
TensorFlow only supports version 3.5.x of Python on Windows.
Related
Here's the full error:
Traceback (most recent call last):
File "C:\Users\richa\Documents\_Projects_\Astr0loger\interface.py", line 26, in <module>
from controller import choose_best_stocks
File "C:\Users\richa\Documents\_Projects_\Astr0loger\controller.py", line 10, in <module>
from trainer import get_data, train_model, test_model
File "C:\Users\richa\Documents\_Projects_\Astr0loger\trainer.py", line 12, in <module>
import tensorflow as tf
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\__init__.py", line 40, in <module>
from tensorflow.python.eager import context
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\eager\context.py", line 35, in <module>
from tensorflow.python import pywrap_tfe
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:/Users/richa/Documents/_Projects_/Astr0loger/astrology_env/Lib/site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
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.
Apparently there are three common causes/fixes to the problem:
Python is 32 bit while the system is 64 bit, or vice versa. I checked, that is not the case.
cpu doesn't support AVX2 instructions - I tried tensorflow-gpu, same issue, so I don't think that's it
You need to install the MSVC 2019 redistributable - I checked, I have it
AAAAAAAAAAH What do I do?
Well, turns out the error was fixed by installing an older version of Tensorflow; 2.0.0. If you're having the same issue, try several versions of tensorflow.
I am working on designing a chatbot using tensorflow in python, I have windows 10 (64 bit) installed with python version 3.6.0.
when trying to execute Python inference.py I got the following error
Traceback (most recent call last):
File "inference.py", line 9, in
from nmt import nmt
File "C:\Users\Ali\Documents\Visual Studio 2017\Projects\SequenceToSequenceModel\nmt-chatbot/nmt\nmt\nmt.py", line 26, in
import tensorflow as tf
File "C:\Users\Ali\AppData\Roaming\Python\Python36\site-packages\tensorflow__init__.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Ali\AppData\Roaming\Python\Python36\site-packages\tensorflow\python__init__.py", line 59, in
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\Ali\AppData\Roaming\Python\Python36\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in
from google.protobuf import descriptor as _descriptor
File "c:\users\ali\appdata\roaming\python\python36\site-packages\google\protobuf\descriptor.py", line 47, in
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
I appreciate any help you provide.
i have installed tensorflow in virtualenv as well as regular system install and added all the required directories to Path
i am using python 3.6.0
installed tensorflow cpu only
import tensorflow as tf
Throws:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\env\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-
import
File "C:\env\lib\site-packages\tensorflow\python\__init__.py", line 59, in
<module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\env\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line
6, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\env\lib\site-packages\google\protobuf\descriptor.py", line 47, in
<module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
Please upgrade your Python Version from 3.6.0 to 3.6.1 and your issue will be resolved.
For more information, please refer Github Issue 1 and Github Issue 2
I know people asked this question before. I believe I tried everything written in other StackOverflow questions (On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error). The new TensorFlow 1.7 requires CUDA Toolkit 9.0 and cuDNN v7.0 (both of which I added to my environment path). I also installed the latest version of Visual Studio 17. I reinstalled Python 3.5; Anaconda; CUDA Toolkit 9.0; cuDNN v7.0. Do you think its because of the new VS studio isn't compatible?
This is the error I get:
import tensorflow as tf
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
This error might be caused because of generation of your processor. I struggled with the same error for CPU mode only. Checked for 2 machines: win 7 pro, i7 1366 socket and win 7 home with i5 1366 socket with the same output.
The problem is that Tensorflow r1.7 seems to require AVX support. Check does your processor support AVX if not switch to Tensor Flow 1.5
For native instalation (python 3.5 or python 3.6)(Tensor Flow r1.5 CPU)
pip3 install tensorflow==1.5
For anaconda (Tensor Flow r1.5 CPU)
conda create -n your_env_name pip python=3.5 (or 3.6)
in next line
activate your_env_name
and finally install Tensorflow 1.5
pip install --ignore-installed tensorflow==1.5
For me two ways work on 2 machines without problems.
I have no idea if you are dealing with GPU because I am new and my graphics is not powerfull enough to use.
Enjoy!
I'm trying to use TensorFlow on my Mac.
I'm in terminal and have followed all directions on the Tensorflow Install page until "Run a short test program"
I'm attempting to write
import tensorflow as tf
But I receive the following message
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/Users/robilin/Library/Python/2.7/lib/python/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: numpy.core.multiarray failed to import
Failed to load the native TensorFlow runtime.
Any help would be great!
It seems that you have an incompatible numpy version.
You need to upgrade numpy
You can run
pip install --upgrade numpy
to upgrade numpy to its latest version