Search code examples
python-3.xnumpyanacondaimporterror

Numpy ImportError using Sublime Text with Anaconda


ImportError trying to import numpy in Sublime Text3 with Anaconda Distribution

I´m trying to import Numpy in Sublime Text3 with Anaconda Distribution. I´ve already set my Build System to Anaconda´s path and Numpy works well in all anaconda´s IDE packages.

Sublime Build System:

{
"path":"C:\\Users\\my_user\\AppData\\Local\\Continuum\\anaconda3\\",
"shell_cmd": "python -u \"$file\"",
"file_regex": "^[]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",

"variants":
[
    {
        "name": "Syntax Check",
        "shell_cmd": "python -m py_compile \"${file}\"",
    }
]
}
import numpy as np

ImportError: DLL load failed: The specified module can not be found.

I expect to import the module correctly, but shows the error:

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: No se puede encontrar el m�dulo especificado.


Solution

  • I have the same problem on my Windows 10, SublimeText 3 64-bit and Anaconda3 64-bit running conda Sublime Text package. Here is a workaround:

    You can try reinstall the numpy python package in the working python environment (env). For example, if you're working on mypython env, open the Anaconda Command Prompt and do this:

    conda activate mypython

    then use pip to reinstall numpy:

    pip install --upgrade --force-reinstall numpy

    then try again in Sublime Text, thing should be fine.