Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python scipy module import error due to missing ._ufuncs dll

I have some troubles with sub-module integrate from scipy in python. I have a 64 bits architecture, and it seems, according to the first lines of the python interpreter (see below) that I am also using a 64 bit build of Python together with Anaconda.

Below is the problem (I just wrote the minimal code to show what's happening)


Python 3.4.3 |Anaconda 2.3.0 (64-bit)| (default, Mar  6 2015, 12:06:10) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> import scipy.integrate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\*********\Anaconda3\lib\site-packages\scipy\integrate\__init__.py", line 55, in <module>
    from .quadrature import *
  File "C:\Users\*********\Anaconda3\lib\site-packages\scipy\integrate\quadrature.py", line 10, in <module>
    from scipy.special.orthogonal import p_roots
  File "C:\Users\*********\Anaconda3\lib\site-packages\scipy\special\__init__.py", line 636, in <module>
    from ._ufuncs import *
ImportError: DLL load failed: Le module spécifié est introuvable.

The same happens with import scipy.special

As you can see scipy can be imported, however scipy.integrate generates an error. What is odd is that in the folder ...\lib\site-packages\scipy\special, the ._ufuncs.pyd is appears. Also, I am using scipty regularly for other purposes, and everythings works usually fine.

I am using version 0.18.0 of scipy and pip 1.8.1. I tried to reinstall scipy with conda but this does not seem to change anything.

It seems that the dll cannot be found. I found a few posts on the internet (including one that advises to download a "libmmd.dll" in C:\Windows\SysWOW64) with similar issue, but none seems to work. My guess is that this is still a pb of 32-64 bit compatibility as this is the most common pb with python and I remembered having huge pb when first seting up everything a few months ago.

So, following up the initial question, is there a way to know which version (32 bit or 64 bit) of each package or dll is effectively installed/loaded? Do you have another idea why I get this error message?

Thank you for your answers, this problem is quite frustrating...

like image 367
Maillard Avatar asked Aug 18 '16 14:08

Maillard


1 Answers

If you use conda and don't want to install MKL and copy the DLLs as mentioned above, I figured out you can fix this by reinstalling icc_rt package:

conda remove icc_rt --force
conda install icc_rt --no-deps

The icc_rt package has the required DLLs (LIBIFCOREMD.DLL and LIBMMD.DLL).

Below is how I investigated this issue:

I encountered the issue after upgrading my Anaconda to latest version using:

conda update conda
conda update anaconda

I ran Process Monitor while doing import scipy.special to trace which DLL it's trying to load and found out it's libifcoremd.dll. ProcMon Trace

I then searched my conda pkg cache folder (~/AppData/Local/Continuum/Anaconda3) to find out which package carries this DLL

$ find . -name '*ifcoremd.*'
./pkgs/icc_rt-2017.0.4-h97af966_0/Library/bin/libifcoremd.dll
./pkgs/mkl-11.3.3-1/Library/bin/libifcoremd.dll
./pkgs/mkl-2017.0.1-0/Library/bin/libifcoremd.dll
./pkgs/mkl-2017.0.3-0/Library/bin/libifcoremd.dll

So it's in both mkl and icc_rt packages. But it looks like the latest anaconda (5.2.0) shipped a more recent version of mkl which apparently doesn't have the DLLs anymore:

$ conda list|egrep '^(mkl|icc_rt)\s'
icc_rt                    2017.0.4             h97af966_0
mkl                       2018.0.2                      1

So presumably when conda upgraded my mkl, it deleted the DLLs from my Library\bin folder. So by force reinstalling icc_rt, I got the DLLs back.

like image 86
sindux Avatar answered Oct 02 '22 14:10

sindux