0
$\begingroup$

I am tyring to import the libraries below

from keras.models import Sequential
from keras.layers import Dense, LSTM

but it is returning below error, kindly help.

ImportError Traceback (most recent call last) ~\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in 57 ---> 58 from tensorflow.python.pywrap_tensorflow_internal import * 59

~\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in 27 return _mod ---> 28 _pywrap_tensorflow_internal = swig_import_helper() 29 del swig_import_helper

~\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper() 23 try: ---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) 25 finally:

~\AppData\Local\Continuum\anaconda3\lib\imp.py in load_module(name, file, filename, details) 241 else: --> 242 return load_dynamic(name, filename, file) 243 elif type_ == PKG_DIRECTORY:

~\AppData\Local\Continuum\anaconda3\lib\imp.py in load_dynamic(name, path, file) 341 name=name, loader=loader, origin=path) --> 342 return _load(spec) 343

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last) in 1 #import libraries ----> 2 from keras.models import Sequential 3 from keras.layers import Dense, LSTM 4 5 #Build the LSTM network model

~\AppData\Local\Continuum\anaconda3\lib\site-packages\keras__init__.py in 1 from future import absolute_import 2 ----> 3 from . import utils 4 from . import activations 5 from . import applications

~\AppData\Local\Continuum\anaconda3\lib\site-packages\keras\utils__init__.py in 4 from . import data_utils 5 from . import io_utils ----> 6 from . import conv_utils 7 from . import losses_utils 8 from . import metrics_utils

~\AppData\Local\Continuum\anaconda3\lib\site-packages\keras\utils\conv_utils.py in 7 from six.moves import range 8 import numpy as np ----> 9 from .. import backend as K 10 11

~\AppData\Local\Continuum\anaconda3\lib\site-packages\keras\backend__init__.py in ----> 1 from .load_backend import epsilon 2 from .load_backend import set_epsilon 3 from .load_backend import floatx 4 from .load_backend import set_floatx 5 from .load_backend import cast_to_floatx

~\AppData\Local\Continuum\anaconda3\lib\site-packages\keras\backend\load_backend.py in 88 elif _BACKEND == 'tensorflow': 89 sys.stderr.write('Using TensorFlow backend.\n') ---> 90 from .tensorflow_backend import * 91 else: 92 # Try and load external backend.

~\AppData\Local\Continuum\anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in 3 from future import print_function 4 ----> 5 import tensorflow as tf 6 from tensorflow.python.eager import context 7 from tensorflow.python.framework import device as tfdev

~\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow__init__.py in 39 import sys as _sys 40 ---> 41 from tensorflow.python.tools import module_util as _module_util 42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader 43

~\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python__init__.py in 48 import numpy as np 49 ---> 50 from tensorflow.python import pywrap_tensorflow 51 52 # Protocol buffers

~\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in 67 for some common reasons and solutions. Include the entire stack trace 68 above this error message when asking for help.""" % traceback.format_exc() ---> 69 raise ImportError(msg) 70 71 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last): File "C:\Users\NGROLAD\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\NGROLAD\AppData\Local\Continuum\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\NGROLAD\AppData\Local\Continuum\anaconda3\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 "C:\Users\NGROLAD\AppData\Local\Continuum\anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Users\NGROLAD\AppData\Local\Continuum\anaconda3\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.

$\endgroup$
2
  • $\begingroup$ Get your indentation correct. The code is unreadable $\endgroup$ – Gayal Kuruppu May 13 '20 at 20:00
  • $\begingroup$ I have updated the code $\endgroup$ – Adex May 13 '20 at 22:25
0
$\begingroup$

Your question title does not match with the question but for the error you have got, this might help

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, LSTM
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.