Python scipy module import error due to missing ._ufuncs dll

2024/9/20 22:56:56

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_rootsFile "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...

Answer

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.

https://en.xdnf.cn/q/72447.html

Related Q&A

How can I call python program from VBA?

Just as the title goes.I have a python program which processes some data file I downloaded from email.I am writing a vba script which can download the email attachments and execute the python program t…

Embedding CPython: how do you constuct Python callables to wrap C callback pointers?

Suppose I am embedding the CPython interpreter into a larger program, written in C. The C component of the program occasionally needs to call functions written in Python, supplying callback functions …

python - beautifulsoup - TypeError: sequence item 0: expected string, Tag found

Im using beautifulsoup to extract images and links from a html string. It all works perfectly fine, however with some links that have a tag in the link contents it is throwing an error.Example Link:<…

Python evdev detect device unplugged

Im using the great "evdev" library to listen to a USB barcode reader input and I need to detect if the device suddenly gets unplugged/unresponsive because otherwise the python script reading …

python: urllib2 using different network interface

I have the following code:f = urllib2.urlopen(url) data = f.read() f.close()Its running on a machine with two network interfaces. Id like to specify which interface I want the code to use. Specifically…

RuntimeError: as_numpy_iterator() is not supported while tracing functions

while i was using function as_numpy_iterator() got error--------------------------------------------------------------------------- RuntimeError Traceback (most recent call…

Pandas assert_frame_equal error

Im building test cases and I want to compare 2 dataframes. Even though dataframe have the same columns and values assert_frame_equal reports are not equal. Column order is different, I tried reordering…

Multiple lines on line plot/time series with matplotlib

How do I plot multiple traces represented by a categorical variable on matplotlib or plot.ly on Python? I am trying to replicate the geom_line(aes(x=Date,y=Value,color=Group) function from R.Is there …

Python ABCs: registering vs. subclassing

(I am using python 2.7) The python documentation indicates that you can pass a mapping to the dict builtin and it will copy that mapping into the new dict:http://docs.python.org/library/stdtypes.html#…

python - ensure script is activated only once

Im writing a Python 2.7 script. In summary, this script is being run every night on Linux and activates several processes.Id like to ensure this script is not run multiple times in parallel (basically …