Ask Your Question

Anaconda cannot import modules such as numpy

asked 2019-03-14 15:32:02 -0600

This is a common problem we've been seeing so I'm adding it here as a question. Anaconda may fail to import modules like numpy with errors such as this:

import numpy
Traceback (most recent call last):
  Python Shell, prompt 1, line 1
    # Used internally for debug sandbox under external interpreter
  File "c:\Users\ylem\AppData\Local\Continuum\anaconda3\Lib\site-packages\numpy\", line 142, in <module>
    from . import add_newdocs
  File "c:\Users\ylem\AppData\Local\Continuum\anaconda3\Lib\site-packages\numpy\", line 13, in <module>
    from numpy.lib import add_newdoc
  File "c:\Users\ylem\AppData\Local\Continuum\anaconda3\Lib\site-packages\numpy\lib\", line 8, in <module>
    from .type_check import *
  File "c:\Users\ylem\AppData\Local\Continuum\anaconda3\Lib\site-packages\numpy\lib\", line 11, in <module>
import numpy.core.numeric as _nx
File "c:\Users\ylem\AppData\Local\Continuum\anaconda3\Lib\site-packages\numpy\core\", line 29, in <module>
  raise ImportError(msg)
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 module could not be found.
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2020-01-22 19:27:49 -0600

As of Wing 7.2 this should no longer be an issue, since Wing now does this automatically when it detects the selected Python is Anaconda.

edit flag offensive delete link more

answered 2019-03-14 15:33:19 -0600

updated 2019-03-15 07:53:30 -0600

This occurs on Windows (at least) when Anaconda is installed without setting PATH. It occurs both inside Wing and if Anaconda is run from the command line. The option to set PATH during installation is disabled by default in the installer but the problems can be avoided by enabling it. However, enabling it only works for one installation at a time and might cause conflicts if running multiple installations of Anaconda.

Another work-around is to run Scripts\activate in the Anaconda installation on the command line and then start Wing from the command line within that activation. This causes Wing to inherited the necessary PATH env.

Or you can add to PATH in Wing's Project Properties with something similar to this:


The advantage of the latter is that you don't need to quit and restart Wing if switching Anaconda installations.

edit flag offensive delete link more

answered 2019-04-03 11:38:35 -0600

updated 2019-05-09 07:16:34 -0600

A better solution is to create a batch file wrap_anaconda.bat with the following contents:

@echo off
call %USERPROFILE%\Anaconda3\Scripts\activate
python %*

You will need to change the second line to match where Anaconda is installed on your system.

Then set Python Executable in Wing's Project Properties (from the Project menu) to the full path to that batch file. This is essentially what I would have expected Anaconda to do on its own. No other configuration is necessary and the solution also works on the command line or from other IDEs.

For other options see

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-03-14 15:32:02 -0600

Seen: 4,662 times

Last updated: Jan 22 '20