Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DLL load failed with scipy.optimize?

I'm trying to upload the curve_fit from scipy.optimize to fit an exponential function to some data I have generated. My code looks like:

import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit

When I run the code, I get the following error:

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

I have scipy in an Anaconda folder on my computer, and I'm 80% sure I installed it. How do I fix this error? (Or if you have a better way of fitting an exponential function to data, I'm all ears)

Thanks!

edit: Here is the full error:

Traceback (most recent call last):
 File "C:\Users\Casey\Documents\Python\Perc_MatPlot3.py", line 10
    from scipy.optimize import curve_fit
  File "C:\Users\Casey\Anaconda\Lib\site-packages\scipy\optimize\__init__.py", line 146
    from .optimize import *
  File "C:\Users\Casey\Anaconda\Lib\site-packages\scipy\optimize\optimize.py", line 35
    from .linesearch import (line_search_BFGS, line_search_wolfe1,
  File "C:\Users\Casey\Anaconda\Lib\site-packages\scipy\optimize\linesearch.py", line 16
    from scipy.optimize import minpack2
ImportError: DLL load failed: The specified module could not be found.
like image 822
user3479740 Avatar asked Mar 31 '14 04:03

user3479740


2 Answers

I encountered the error

    from ._ufuncs import *
ImportError: DLL load failed: The specified module could not be found.

when using cgoehlke's "Unofficial Windows Binaries for Python Extension Packages" for SciPy with a pip3-installed NumPy, overlooking this note:

Many binaries depend on NumPy-1.9+MKL and ...

Their NumPy provides the missing DLLs / modules.

like image 129
non Avatar answered Oct 20 '22 01:10

non


I've run into several problems like this recently when trying to use pyplot and scipy. I have Anaconda 2.7, 32bit running on Windows 7 x64

I just encountered this exact error whilst trying to use curve_fit. I downloaded the 'superpack' from sourceforge: http://sourceforge.net/projects/scipy/

Running this installer fixed the error and didn't affect any other part of my python environment.

like image 44
user2751383 Avatar answered Oct 19 '22 23:10

user2751383