Re: [matplotlib-devel] Error in import matplotlib.pyplot using Python/C API

2013-09-11 Thread Filipe Saraiva
Em Ter 10 Set 2013 19:21:01 BRT, Christoph Gohlke escreveu:
> On 9/10/2013 1:54 PM, Eric Firing wrote:
>> On 2013/09/10 5:43 AM, Michael Droettboom wrote:
>>> Do any of those use ctypes?  Try creating a minimal ctypes example and
>>> see if that works.
>>
>> Mike,
>>
>> I was a bit horrified to see that ctypes import and usage in mpl;
>> fortunately it is a workaround for a PySide bug, and should only be
>> temporary, if it should be there at all.
>>
>> Eric
>>
>
> Don't be horrified. The Ctypes workaround went trough the mailing list,
> a PR with discussions including most core developers, testing, several
> beta/rc/final versions, and real word usage. It fixes a problem that is
> still present today without it: the Qt4Agg backend is practically
> unusable with any recent version of PySide on CPython 3.x. Anyway, the
> Ctypes code could be put in a try/except statement for environments that
> don't support Ctypes or Python's C API.

If I understood correctly is there a problem with Qt4Agg in matplotlib 
1.3?

Another KDE developer typed:

import matplotlib
from matplotlib import pyplot as plt

In my software (Cantor backend for python) and he got the error below:

Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 98, 
in
_backend_mod, new_figure_manager, draw_if_interactive, _show = 
pylab_setup()
File 
"/usr/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line
25, in pylab_setup
globals(),locals(),[backend_name])
File 
"/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py",
line 13, in
from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
File 
"/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py",
line 25, in
from qt4_compat import QtCore, QtGui, _getSaveFileName, __version__
File 
"/usr/lib/python2.7/site-packages/matplotlib/backends/qt4_compat.py",
line 36, in
import sip
ImportError: /usr/lib/python2.7/site-packages/sip.so: undefined symbol:
PyExc_SystemError

One more info, I removed matplotlib 1.3 and installed matplotlib 1.2 
using pip and it worked properly. I can use matplotlib in this version.

Thank you;

--
Filipe Saraiva
http://filipesaraiva.info/

--
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=5127&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Error in import matplotlib.pyplot using Python/C API

2013-09-11 Thread Eric Firing
On 2013/09/11 8:49 AM, Filipe Saraiva wrote:
> Em Ter 10 Set 2013 19:21:01 BRT, Christoph Gohlke escreveu:
>> On 9/10/2013 1:54 PM, Eric Firing wrote:
>>> On 2013/09/10 5:43 AM, Michael Droettboom wrote:
 Do any of those use ctypes?  Try creating a minimal ctypes example and
 see if that works.
>>>
>>> Mike,
>>>
>>> I was a bit horrified to see that ctypes import and usage in mpl;
>>> fortunately it is a workaround for a PySide bug, and should only be
>>> temporary, if it should be there at all.
>>>
>>> Eric
>>>
>>
>> Don't be horrified. The Ctypes workaround went trough the mailing list,
>> a PR with discussions including most core developers, testing, several
>> beta/rc/final versions, and real word usage. It fixes a problem that is
>> still present today without it: the Qt4Agg backend is practically
>> unusable with any recent version of PySide on CPython 3.x. Anyway, the
>> Ctypes code could be put in a try/except statement for environments that
>> don't support Ctypes or Python's C API.
>
> If I understood correctly is there a problem with Qt4Agg in matplotlib
> 1.3?
>
> Another KDE developer typed:
>
> import matplotlib
> from matplotlib import pyplot as plt
>
> In my software (Cantor backend for python) and he got the error below:
>
> Traceback (most recent call last):
> File "", line 1, in
> File "/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 98,
> in
> _backend_mod, new_figure_manager, draw_if_interactive, _show =
> pylab_setup()
> File
> "/usr/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line
> 25, in pylab_setup
> globals(),locals(),[backend_name])
> File
> "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py",
> line 13, in
> from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
> File
> "/usr/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py",
> line 25, in
> from qt4_compat import QtCore, QtGui, _getSaveFileName, __version__
> File
> "/usr/lib/python2.7/site-packages/matplotlib/backends/qt4_compat.py",
> line 36, in
> import sip
> ImportError: /usr/lib/python2.7/site-packages/sip.so: undefined symbol:
> PyExc_SystemError

Again, this is a failure of a module to find a Python API symbol.  In 
this case, it is not a matplotlib module, it is sip, part of pyqt4.  It 
seems like some sort of linking problem.

>
> One more info, I removed matplotlib 1.3 and installed matplotlib 1.2
> using pip and it worked properly. I can use matplotlib in this version.

I'm glad you found something that works; but I don't know why it does.

Eric

>
> Thank you;
>
> --
> Filipe Saraiva
> http://filipesaraiva.info/
>
> --
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT
> 2. Standardize and globalize service processes across IT
> 3. Implement zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=5127&iu=/4140/ostg.clktrk
> ___
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>


--
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=5127&iu=/4140/ostg.clktrk
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel