Windows/matplotlib error

235 views
Skip to first unread message

Ben

unread,
May 16, 2011, 5:00:35 PM5/16/11
to PyInstaller
Hello,

I am trying to package up a program on Windows 7 with the recently
released PyInstaller 1.5. The program runs fine when I use it in the
un-packaged version, so I know that all my dependencies (which include
Qt, PyQt, and matplotlib) are available to my python interpreter
(version 2.7). Separately, I can also package it under Linux and the
packaged version runs perfectly there. Under Windows, I can package it
fine, but when I try to run the built version, it immediately exits
with the traceback below. Does anyone know what I can do to fix this?
Thanks!

Ben

Traceback (most recent call last):
File "<string>", line 26, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/Pysciplot", line 23, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/matplotlib", line 135, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/matplotlib.rcsetup", line 19, in
<module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/matplotlib.colors", line 52, in
<module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/numpy", line 141, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/numpy.add_newdocs", line 9, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/numpy.lib", line 13, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/numpy.lib.polynomial", line 17, in
<module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/numpy.linalg", line 48, in <module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 436, in
importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 521, in
doimport
exec co in mod.__dict__
File "C:\Users\Ben\Programming\pysciplot.git\packager\build
\pyi.win32\psp-win\outPYZ1.pyz/numpy.linalg.linalg", line 23, in
<module>
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 477, in
importHook
mod = self.doimport(nm, ctx, ctx+'.'+nm)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 495, in
doimport
mod = importfunc(nm)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 297, in
getmod
mod = owner.getmod(nm)
File "C:\Users\Ben\Programming\pyinstaller-1.5\archive.py", line
468, in getmod
return iu.DirOwner.getmod(self, self.prefix+'.'+nm)
File "C:\Users\Ben\Programming\pyinstaller-1.5\iu.py", line 109, in
getmod
mod = imp.load_module(nm, fp, attempt, (ext, mode, typ))
ImportError: DLL load failed: The specified module could not be found.

Martin Zibricky

unread,
May 16, 2011, 5:29:26 PM5/16/11
to pyins...@googlegroups.com
Ben píše v Po 16. 05. 2011 v 14:00 -0700:

> I am trying to package up a program on Windows 7 with the recently
> released PyInstaller 1.5. The program runs fine when I use it in the
> un-packaged version, so I know that all my dependencies (which include
> Qt, PyQt, and matplotlib) are available to my python interpreter
> (version 2.7). Separately, I can also package it under Linux and the
> packaged version runs perfectly there. Under Windows, I can package it
> fine, but when I try to run the built version, it immediately exits
> with the traceback below. Does anyone know what I can do to fix this?
> Thanks!

Could you please try latest svn version if the error is still the same?

We would also appreciate a small python script with only the failing
case. This would ease trying to reproduce your error.

Ben

unread,
May 16, 2011, 6:05:22 PM5/16/11
to PyInstaller
Ok, I just tried it with the latest svn version (r1406) and the error
still occurs.

I'm not sure if I can attach a file in this list, so I've included
some simple sample code below that reproduces this problem on my
system.

Ben

----------------
import matplotlib.pyplot as plt

x = [0,1,2,3,4,5]
y = [0,1,4,9,16,25]

plt.plot(x, y)
plt.show()
----------------

Martin Zibricky

unread,
May 16, 2011, 6:54:08 PM5/16/11
to pyins...@googlegroups.com
Ben píše v Po 16. 05. 2011 v 15:05 -0700:

> ----------------
> import matplotlib.pyplot as plt
>
> x = [0,1,2,3,4,5]
> y = [0,1,4,9,16,25]
>
> plt.plot(x, y)
> plt.show()
> ----------------

I tried this code on my winxp virtual machine with python 2.7.1 numpy
1.6 and matplotlib 1.0.1 and it works.

what is the output of command 'echo %path%'?

what is the full path to directory where the executable is placed?

Ben Breslauer

unread,
May 16, 2011, 7:29:23 PM5/16/11
to pyins...@googlegroups.com
echo %path% gives:

C:\Python27\Lib\site-packages\PyQt4\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32WindowsPowerShell\v1.0\;C:\Program
Files (x86)\QuickTime\QTSystem\;C:\Program
Files\TortoiseGit\bin;C:\Program Files\Microsoft Windows Performance
Toolkit\


The path for the python code below is
C:\Users\Ben\Programming\pyi-mpl-test\test.py

The path where PyInstaller is located is
C:\Users\Ben\Programming\pyinstaller-trunk-r1406

The path to the exe I'm trying to run is
C:\Users\Ben\Programming\pyi-mpl-test\dist\test\test.exe

> --
> You received this message because you are subscribed to the Google Groups "PyInstaller" group.
> To post to this group, send email to pyins...@googlegroups.com.
> To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
>
>

Martin Zibricky

unread,
May 16, 2011, 7:37:41 PM5/16/11
to pyins...@googlegroups.com
Ben Breslauer píše v Po 16. 05. 2011 v 19:29 -0400:

> echo %path% gives:
>
> C:\Python27\Lib\site-packages\PyQt4\bin;C:\Windows\system32;C:
> \Windows;C:\Windows\System32\Wbem;C:\Windows\System32WindowsPowerShell
> \v1.0\;C:\Program
> Files (x86)\QuickTime\QTSystem\;C:\Program
> Files\TortoiseGit\bin;C:\Program Files\Microsoft Windows Performance
> Toolkit\
>
>
> The path for the python code below is
> C:\Users\Ben\Programming\pyi-mpl-test\test.py
>
> The path where PyInstaller is located is
> C:\Users\Ben\Programming\pyinstaller-trunk-r1406
>
> The path to the exe I'm trying to run is
> C:\Users\Ben\Programming\pyi-mpl-test\dist\test\test.exe

Do you use 32bit or 64bit python?

Ben Breslauer

unread,
May 16, 2011, 8:12:10 PM5/16/11
to pyins...@googlegroups.com
I'm using 64bit python, along with the 64bit pywin32 for python 2.7.

Martin Zibricky

unread,
May 17, 2011, 5:47:29 PM5/17/11
to pyins...@googlegroups.com
Ben Breslauer píše v Po 16. 05. 2011 v 20:12 -0400:

> I'm using 64bit python, along with the 64bit pywin32 for python 2.7.

I just tried numpy, matplotlib and qt4 with 64bit python 2.7.1 on 64bit
win7 and it works. No DLL error. I'm not able to reproduce your error.

What is your python distribution? Is it the one from www.python.org or
is it activestate python or any other?

Could you try running that small example when unsetting PATH env.
variable by

set path=

Ben Breslauer

unread,
May 17, 2011, 7:01:53 PM5/17/11
to pyins...@googlegroups.com
I just tried (re)installing Python and all the other dependencies I
needed, and it now seems to work. For future reference, in case
anybody happens upon this thread, I installed, in order

Python 2.7.1 (from www.python.org)
numpy 1.6.0 (from http://www.lfd.uci.edu/~gohlke/pythonlibs/, non-MKL version)
matplotlib 1.0.1 (from http://www.lfd.uci.edu/~gohlke/pythonlibs/)
PyQt 4.8.4 (from
http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py2.7-x86-gpl-4.8.4-1.exe)
Pyinstaller trunk

Thanks for all your help in determining that it was my local system
that had the problem.

Ben

Reply all
Reply to author
Forward
0 new messages