"module could not be found" error
Robert.Flintham at uhb.nhs.uk
Tue Mar 19 16:58:51 CET 2013
Joel: The 2.7 is the version number of the PyDev plugin for Eclipse, rather than the Python version number.
Dave: I don't have access to the system's PATH environment variable because this computer is very tightly controlled. However, my user PATH environment contains "K:\Python33", which I haven't had a problem with before when importing modules from site-packages.
The directory "site-packages\scipy\optimize" contains (among other things):
So I'm not entirely sure what it is that it can't find.
All the best,
(Apologies for lengthy disclaimers, I can't get rid of them. Work email.)
From: Python-list [mailto:python-list-bounces+robert.flintham=uhb.nhs.uk at python.org] On Behalf Of Dave Angel
Sent: 19 March 2013 15:24
To: python-list at python.org
Subject: Re: "module could not be found" error
On 03/19/2013 11:10 AM, Robert Flintham wrote:
> I'm trying to run the following, with <an array> representing an array of floating point numbers:
> import numpy as np
> import scipy as sp
> from scipy import optimize
> xdata=<an array>
> ydata=<an array>
> def t2fit(x,T2,A):
> return A * np.exp(-x/T2)
> popt, pcov = optimize.curve_fit(t2fit, xdata, ydata, p0=None,
> But I'm getting an ImportError:
> Traceback (most recent call last):
> File "K:\eclipse\plugins\org.python.pydev_126.96.36.1992100913\pysrc\pydevd.py", line 1397, in <module>
> debugger.run(setup['file'], None, None)
> File "K:\eclipse\plugins\org.python.pydev_188.8.131.522100913\pysrc\pydevd.py", line 1090, in run
> pydev_imports.execfile(file, globals, locals) #execute the script
> File "K:\eclipse\plugins\org.python.pydev_184.108.40.2062100913\pysrc\_pydev_execfile.py", line 38, in execfile
> exec(compile(contents+"\n", file, 'exec'), glob, loc) #execute the script
> File "K:\PROGRAMMING\MRI_Python\fatfrac.py", line 7, in <module>
> from scipy import optimize
> File "K:\Python33\lib\site-packages\scipy\optimize\__init__.py", line 147, in <module>
> from ._minimize import *
> File "K:\Python33\lib\site-packages\scipy\optimize\_minimize.py", line 29, in <module>
> from .lbfgsb import _minimize_lbfgsb
> File "K:\Python33\lib\site-packages\scipy\optimize\lbfgsb.py", line 40, in <module>
> from . import _lbfgsb
> ImportError: DLL load failed: The specified module could not be found.
> I've checked the path, and the file lbfgsb.py is definitely at that location (as are optimize.py and _minimize.py). Does anyone know why I'm getting the error?
You're on Windows, so presumably you're using the PATH environment variable for the following search.
You checked the path for what file? it's looking for _lhfgsb.dll, or maybe _lhfgsb.pyc which is imported by lbfgsh.py. The latter file is found, as you can tell from the stack trace. That's the file you got the error in.
So perhaps the dll isn't being loaded into a directory that's on the PATH.
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.
More information about the Python-list