shengyunHuang / pythonxy

Automatically exported from code.google.com/p/pythonxy
0 stars 0 forks source link

Command-line python: scipy/matplotlib import failure #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When using Python from command line (not via Pythonxy console), importing
matplotlib can fail if scipy is imported first.

There are two common ways to arrive at this:

- running Python directly from cmd.exe
- running Python scripts by double-clicking them

The latter is probably the more common use case. It would be nice to
distribute scripts that produce output via matplotlib.

What occurs is:

C:\Documents and Settings>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import *
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\program
files\pythonxy\python\lib\site-packages\matplotlib\pyplot.py", line 75, in
<module>
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File "c:\program
files\pythonxy\python\lib\site-packages\matplotlib\backends\__init__.py",
line 23, in pylab_setup
    globals(),locals(),[backend_name])
  File "c:\program
files\pythonxy\python\lib\site-packages\matplotlib\backends\backend_qt4agg.py",
line 12, in <module>
    from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
  File "c:\program
files\pythonxy\python\lib\site-packages\matplotlib\backends\backend_qt4.py", 
line
16, in <module>
    from PyQt4 import QtCore, QtGui, Qt
ImportError: DLL load failed: Invalid memory address

But it works if the order of the imports is reversed:

>>> import matplotlib.pyplot as plt
>>> from scipy import *

Operating system: Windows XP SP 3. Python(x,y) 2.0.5.

Original issue reported on code.google.com by pvi...@gmail.com on 16 Sep 2008 at 3:19

GoogleCodeExporter commented 9 years ago
Thanks for this bug report: apparently this bug is related to PyQt 4.4.3 (it 
didn't
occur with PyQt 4.3.3).

Original comment by pierre.raybaut on 26 Sep 2008 at 10:24

GoogleCodeExporter commented 9 years ago
This bug is related to the way PyQt 4.4.3 was built (Phil Thompson, Riverbank
Computing): DLLs are using *static* memory addresses (which is a really bad 
idea...)
and one of them is already taken by SciPy's DLLs when they are loaded first 
(because
a lot of DLLs are stored in memory when you type "from scipy import *").

Original comment by pierre.raybaut on 24 May 2009 at 8:11