NumPy library ImportError: DLL load failed: The specified procedure could not be found

Hoang V. Pham picture Hoang V. Pham · Jun 14, 2017 · Viewed 23.7k times · Source

I'm learning python using Visual Studio 2017 on Windows 10. When I'm trying to import NumPy library into my code, this error appears. I have tried uninstalling and reinstalling, looking for libiomp5md.dll per instruction in ImportError: DLL load failed when importing Numpy installed in conda virtual environment but to no prevail.

Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified procedure could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\adm\documents\visual studio 2017\Projects\Web Scraping\Web Scraping\Web_Scraping.py", line 17, in <module>
import numpy
  File "C:\Program Files\Python36\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
  File "C:\Program Files\Python36\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
  File "C:\Program Files\Python36\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
  File "C:\Program Files\Python36\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
  File "C:\Program Files\Python36\lib\site-packages\numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy. 
If you're working with a numpy git repo, try `git clean -xdf` (removes all 
files not under version control).  Otherwise reinstall numpy.

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

Answer

user1024 picture user1024 · Aug 10, 2019

I encountered the same problem with VSCode, and I resolved it by adding the following path to the system environment. After that restart VSCode and everything is OK.

C:\Users\<Your user name>\Anaconda3\Library\bin

If the anaconda was not installed in the default directory, please find your own Anaconda3\Library\bin.