ImportError: Could not find the DLL(s) 'msvcp140_1.dll'.

Rostyslav 1 Reputation point
2021-07-29T13:17:34.367+00:00

Hello,

I am having a problem with the DLL files in VS Code.
When I do

import tensorflow  

I receive an error message, which says

Traceback (most recent call last):  
  File "c:\Users\Rostyslav\Git\study\study.py", line 5, in <module>  
    import tensorflow  
  File "C:\Users\Rostyslav\anaconda3\envs\hiwi-kt\lib\site-packages\tensorflow\__init__.py", line 41, in  
<module>  
  File "C:\Users\Rostyslav\anaconda3\envs\hiwi-kt\lib\site-packages\tensorflow\python\__init__.py", line  
50, in <module>  
    from tensorflow.python import pywrap_tensorflow  
  File "C:\Users\Rostyslav\anaconda3\envs\hiwi-kt\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>  
    self_check.preload_check()  
  File "C:\Users\Rostyslav\anaconda3\envs\hiwi-kt\lib\site-packages\tensorflow\python\platform\self_check.py", line 53, 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 have downloaded and installed VC_redist.x64.exe as indicated by the message as you may also see in the screenshot below

![119020-image.png

In my environment variable I gave the path to the 'msvcp140_1.dll' file
119125-image.png

119131-image.png

I do not understand where the problem is coming from for already several days! Could somebody help me with this issue?

Thank you!

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,647 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
947 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
971 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,546 Reputation points Microsoft Vendor
    2021-08-02T09:30:58.597+00:00

    Hi @Rostyslav ,

    Perhaps you can try to copy the msvcp140_1.dll file to the python directory. For example(the path) C:\Users\XXXXXX\AppData\Local\Programs\Python\PythonXX

    Or anybody else I could ask?

    You can also ask this question on Stack Overflow tagged Visual Studio Code, or GitHub.

    Best Regards,
    Tianyu

    • If the answer is helpful, please click "Accept Answer" and upvote it.
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments

  2. Rostyslav 1 Reputation point
    2021-08-06T13:57:56.83+00:00

    @Tianyu Sun-MSFT @Viorel thank you for the hints! Actually the reason was in the conflict of the tensorflow with python and some other packages. There are threads about it in the tensorflow issues on github.

    If somebody comes across the similar issue: I solved the problem by completely removing the conda environment and reinstalling python 3.6.8 with tensorflow 1.14.0. Note that there can be some other packages that conflict with tensorflow, so I would recommend to install only python with tensorflow first, check for the conflicts (e.g. by doing import tensorflow) and if everything is smooth, install another package.

    0 comments No comments