ImportError: DLL load failed with error code -1073741795

When trying to run the following code (Python 3.7.3) in Anaconda, appears to be a TensorFlow package issue, any help to resolve is highly appreciated

from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals

import logging

from rasa_core.agent import Agent
from rasa_core.policies.keras_policy import KerasPolicy
from rasa_core.policies.memoization import MemoizationPolicy

if __name__ == '__main__':
	logging.basicConfig(level='INFO')
	
	training_data_file = './data/stories.md'
	model_path = './models/dialogue'
	
	agent = Agent('weather_domain.yml', policies = [MemoizationPolicy(max_history=2), KerasPolicy(max_history=4)])
	data = agent.load_data(training_data_file)
	agent.train(data)

	agent.persist(model_path)

The below error pops up

ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-1-df3dff1af747> in <module>
      5 import logging
      6 
----> 7 from rasa_core.agent import Agent
      8 from rasa_core.policies.keras_policy import KerasPolicy
      9 from rasa_core.policies.memoization import MemoizationPolicy

~\Anaconda3\lib\site-packages\rasa_core\__init__.py in <module>
      4 
      5 from rasa_core.train import train
----> 6 from rasa_core.test import test
      7 from rasa_core.visualize import visualize
      8 

~\Anaconda3\lib\site-packages\rasa_core\test.py in <module>
     17                               UserUttered)
     18 from rasa_core.interpreter import NaturalLanguageInterpreter
---> 19 from rasa_core.policies.form_policy import FormPolicy
     20 from rasa_core.trackers import DialogueStateTracker
     21 from rasa_core.training.generator import TrainingDataGenerator

~\Anaconda3\lib\site-packages\rasa_core\policies\__init__.py in <module>
----> 1 from rasa_core.policies.policy import Policy
      2 from rasa_core.policies.ensemble import SimplePolicyEnsemble, PolicyEnsemble
      3 from rasa_core.policies.fallback import FallbackPolicy
      4 from rasa_core.policies.keras_policy import KerasPolicy
      5 from rasa_core.policies.memoization import (

~\Anaconda3\lib\site-packages\rasa_core\policies\policy.py in <module>
      1 import copy
      2 import logging
----> 3 import tensorflow as tf
      4 from typing import (
      5     Any, List, Optional, Text, Dict, Callable)

~\Anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
     26 
     27 # pylint: disable=g-bad-import-order
---> 28 from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
     29 from tensorflow.python.tools import module_util as _module_util
     30 

~\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
     47 import numpy as np
     48 
---> 49 from tensorflow.python import pywrap_tensorflow
     50 
     51 # Protocol buffers

~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     72 for some common reasons and solutions.  Include the entire stack trace
     73 above this error message when asking for help.""" % traceback.format_exc()
---> 74   raise ImportError(msg)
     75 
     76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "C:\Users\CommonUse\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\CommonUse\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\CommonUse\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\CommonUse\Anaconda3\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\CommonUse\Anaconda3\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed with error code -1073741795


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.
1 Like

Can you check out this thread and see if it helps?

I tried but the wheel tensorflow-1.6.0-cp36-cp36m-win_amd64.whl is for AMD processor, I get the following error message tensorflow-1.6.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

Maybe a basic question, same code works fine in my Mac, but when trying to execute in a old laptop (Pentium Dual core, T4200) it errors out in TensorFlow package TF does this have anything to do with processor too?

Yeah it probably does have to do with the processor, we run into lots of tensorflow issues on windows/other platforms that never pop up on mac, you will probably have to dig to find a compatible tf wheel

Lets close this issue as its more to deal with hardware config