Numpy fails (windows 10 cpu only environment install)

Hi! I’m attempting to install dlc on windows using the provided environment for a CPU-only install. The numpy package seems to be broken out of the box. Some guidance in figuring out what went wrong would be appreciated.

(dlc-windowsCPU) C:\Anaconda3\envs\dlc-windowsCPU>ipython
Python 3.6.8 |Anaconda, Inc.| (default, Feb 11 2019, 15:03:47) [MSC v.1915 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.0.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import deeplabcut
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\numpy\core\__init__.py in <module>()
     15 try:
---> 16     from . import multiarray
     17 except ImportError as exc:

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

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-1-52d2df9c7fa5> in <module>()
----> 1 import deeplabcut

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\deeplabcut\__init__.py in <module>()
     17 import os
     18
---> 19 import matplotlib as mpl
     20 if os.environ.get('DLClight', default=False) == 'True':
     21     mpl.use('AGG') #anti-grain geometry engine #https://matplotlib.org/faq/usage_faq.html

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\matplotlib\__init__.py in <module>()
    125 # cbook must import matplotlib only within function
    126 # definitions, so it is safe to import from it here.
--> 127 from . import cbook
    128 from matplotlib.cbook import (
    129     _backports, mplDeprecation, dedent, get_label, sanitize_sequence)

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\matplotlib\cbook\__init__.py in <module>()
     33 from weakref import ref, WeakKeyDictionary
     34
---> 35 import numpy as np
     36
     37 import matplotlib

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\numpy\__init__.py in <module>()
    140         return loader(*packages, **options)
    141
--> 142     from . import add_newdocs
    143     __all__ = ['add_newdocs',
    144                'ModuleDeprecationWarning',

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\numpy\add_newdocs.py in <module>()
     11 from __future__ import division, absolute_import, print_function
     12
---> 13 from numpy.lib import add_newdoc
     14
     15 ###############################################################################

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\numpy\lib\__init__.py in <module>()
      6 from numpy.version import version as __version__
      7
----> 8 from .type_check import *
      9 from .index_tricks import *
     10 from .function_base import *

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\numpy\lib\type_check.py in <module>()
      9            'common_type']
     10
---> 11 import numpy.core.numeric as _nx
     12 from numpy.core.numeric import asarray, asanyarray, array, isnan, zeros
     13 from .ufunclike import isneginf, isposinf

c:\anaconda3\envs\dlc-windowscpu\lib\site-packages\numpy\core\__init__.py in <module>()
     24 Original error was: %s
     25 """ % (exc,)
---> 26     raise ImportError(msg)
     27 finally:
     28     for envkey in env_added:

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 module could not be found.


In [2]:

Based on discussion in a couple other topics (here and here) it seems like running

conda install msvc_runtime

resolves the issue for several people. It worked for me when I was setting up DLC from the provided .yaml earlier this week.

1 Like

We will add that command to the conda files in the next update. Unclear why is is now required, but seems the case for many users since early Feb…

1 Like

Many thanks!

This command initially failed with some nebulous permission errors but went through when I reinstalled anaconda on a different path.

I got the same error a few days ago plus errors when attempting to conda install new packages in the dlc venv and any future venvs created with conda. This comment says that it was a conda issue which they patched in the latest update: https://github.com/conda/conda/issues/6007#issuecomment-464746782. Both

conda install msvc_runtime

and

conda update -c conda-canary conda

worked for me, though I had to do the msvc_runtime install in the base environment since I was getting the package install error in the dlc envrionment.