question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DLL load failed on Visual Studio Code

See original GitHub issue

VSC is not able to import numpy. I’m using Anaconda3, so I made sure it was updated and reinstalled numpy, and even used different numpy versions, but VSC still would not recognize numpy. Not sure if it has to do with getting an error when it automatically runs “conda activate base.”

Reproducing code example:

import numpy
x = numpy.array([1,2,3])
print(x)

Error message:

PS C:\Users\**\Desktop\**> conda activate base
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script     
file, or operable program. Check the spelling of the name, or if a path was included,    
verify that the path is correct and try again.
At line:1 char:1
+ conda activate base
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundExcepti  
   on
    + FullyQualifiedErrorId : CommandNotFoundException
 PS C:\Users\**\Desktop\***t> & C:/Users/**/Anaconda3/python.exe "c:/Users/**/Desktop/**/test.py"
Traceback (most recent call last):
  File "C:\Users\**\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 17, in <module>
    from . import multiarray
  File "C:\Users\**\Anaconda3\lib\site-packages\numpy\core\multiarray.py", line 14, in 
<module>
    from . import overrides
  File "C:\Users\**\Anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:/Users/**/Desktop/Courses/CS AI/Tournament/test.py", line 1, in <module>     
    import numpy
  File "C:\Users\**\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\**\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "C:\Users\**\Anaconda3\python.exe", 
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.17.4" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: DLL load failed: The specified module could not be found.

Numpy/Python version information:

Numpy 1.17.4 (I also tried 1.18.1) Python 3.7.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sebergcommented, May 3, 2020

There is a comment here that claims that VSCode is just not able to cope with anaconda (I guess activate it correctly): https://github.com/numpy/numpy/issues/15343

There is a comment here: https://github.com/numpy/numpy/issues/15183 which looks like it may have a way to make VSCode actually do the right thing.

If you figure this out, can you post the solution so we can include it in our new troubleshooting page? (https://numpy.org/devdocs/user/troubleshooting-importerror.html)

0reactions
sebergcommented, May 3, 2020

Seems like the correct thing to link to would be https://code.visualstudio.com/docs/python/environments

Read more comments on GitHub >

github_iconTop Results From Across the Web

"DLL load failed" in Visual Studio Code when trying to open ...
This issue happens when you run VS code standalone and not in the anaconda prompt. The more complicated solution is to add anaconda...
Read more >
DLL load failed on Visual Studio Code - Python/Anaconda
This is my first time using VS Code and it runs python fine, but it is not able to import numpy. I'm using...
Read more >
dll load failed the specified module could not be found (Fix)
importerror: dll load failed: The specified module could not be found error occurs because of the incompatibilities of Microsoft Visual C++ (Visual Studio) ......
Read more >
ImportError('DLL load failed: The specified module could not ...
I get a error of"ImportError('DLL load failed: The specified module could not be found.')" when running the below code in Python
Read more >
"DLL load failed: The specified module could not be found ...
A month ago, the debug system was running as it was supposed to, however, if I include a breakpoint and try debugging on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found