Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97473

DLL load failed: The specific module could not be found (VSCode, Numpy)

$
0
0

Error occurs upon import numpy as np; command works fine when typed directly in terminal, but fails when ran via Code Runner. My steps to reproduce below.

Output of import sys; print(sys.version) is 3.7.5 (default, Oct 31 2019, 15:18:51) [MSC v.1916 64 bit (AMD64)]. VSCode shows it's running the expected Python interpreter: Python 3.7.5 64-bit ('vsc': conda) at bottom-left pane (see clip). -- Brief video demo.

For a complete list of enabled extensions and contents of settings.json, see relevant Git.

What is the problem, and how to fix?


Env info: Windows 10 x64, Anaconda 10/19 (virtual env), VSCode 1.41.1


Steps to reproduce:

conda create --name vsc
conda activate vsc
conda install python==3.7.5
conda install numpy
# in VSCode: import numpy as np, etc

Full traceback:

Traceback (most recent call last):
  File "D:\Anaconda\envs\vsc\lib\site-packages\numpy\core\__init__.py", line 17, in <module>
    from . import multiarray
  File "D:\Anaconda\envs\vsc\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "D:\Anaconda\envs\vsc\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:\Desktop\School\Python\vscode\HelloWorld\app.py", line 1, in <module>
    import numpy as np
  File "D:\Anaconda\envs\vsc\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "D:\Anaconda\envs\vsc\lib\site-packages\numpy\core\__init__.py", line 47, in <module>
    raise ImportError(msg)
ImportError: 

EDIT: added the following to settings.json per James's suggestion:

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "D:\\Anaconda\\Scripts\\activate.bat D:\\Anaconda"],
"python.condaPath": "D:\\Anaconda\\Scripts\\conda.exe"

Viewing all articles
Browse latest Browse all 97473

Trending Articles