Search code examples
pythontensorflowimporterror

Tensorflow image detection, ImportError: Could not find the DLL(s) 'msvcp140_1.dll'


I am trying to follow this video but I am getting this error:

Traceback (most recent call last):
  File "C:\Tensorflow-object-detection\TFODCourse\Tensorflow\models\research\object_detection\builders\model_builder_tf2_test.py", line 21, in <module>
    import tensorflow.compat.v1 as tf
  File "C:\Tensorflow-object-detection\TFODCourse\tfod\lib\site-packages\tensorflow\__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Tensorflow-object-detection\TFODCourse\tfod\lib\site-packages\tensorflow\python\__init__.py", line 36, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
  File "C:\Tensorflow-object-detection\TFODCourse\tfod\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 26, in <module>
    self_check.preload_check()
  File "C:\Tensorflow-object-detection\TFODCourse\tfod\lib\site-packages\tensorflow\python\platform\self_check.py", line 50, in preload_check
    raise ImportError(
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% environment variable. You may install these DLLs by downloading "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads

I guess it was due to the absence of the 'msvcp140_1.dll' file. However, the 'msvcp140_1.dll' file is in my C:\Windows\SysWOW64 path; I don't know what the reason is. So, I went to this address, downloaded it and rebooted my pc, but the problem still exists. How can I solve this problem?


Solution

  • Looks like issue with MS Visual studio. You need download and install visual studio 2015-2019 x86 and x64 from here: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads.

    You need to check, does your CPU support AVX2 instructions or not.