build matplotlib including backend wxPython

Hello list,

I was not up to date with my installation and I tried to use the latest svn
version (trunk) on my Debian etch. I have a problem to build matplotlib
including support for wxPython as backend. The output is attached below.

Actually I cannot find a file "wxPython.h" on my system.

Can anybody give me a hint what I'm doing wrong?
How can I find wx headers and tell their location matplotlib?

best regards and thanks in advance for any hint,
Matthias

$ python setup.py build

···

============================================================================
BUILDING MATPLOTLIB
            matplotlib: 0.98pre
                python: 2.4.4 (#2, Apr 5 2007, 20:11:18) [GCC 4.1.2
                        20061115 (prerelease) (Debian 4.1.1-21)]
              platform: linux2

REQUIRED DEPENDENCIES
                 numpy: 1.0.4
             freetype2: 9.10.3

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.15beta5
               Tkinter: Tkinter: 39220, Tk: 8.4, Tcl: 8.4
              wxPython: 2.6.3.2
                        * Could not find wxPython headers in any of
                        * '/usr/lib/wx/include/gtk2-unicode-release-2.6',
                        * '/usr/include/wx-2.6'
                  Gtk+: gtk+: 2.8.20, glib: 2.12.4, pygtk: 2.8.6, pygobject:
                        [pre-pygobject]
                    Qt: Qt: 3.3.6, PyQt: 3.16
                   Qt4: no
                 Cairo: 1.2.0

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: present, version unknown
                  pytz: 2006p

OPTIONAL USETEX DEPENDENCIES
                dvipng: 1.9
           ghostscript: 8.15.3
                 latex: 3.141592
               pdftops: 3.01

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
             configobj: matplotlib will provide
      enthought.traits: matplotlib will provide

[Edit setup.cfg to suppress the above messages]

running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc ->
build/lib.linux-i686-2.4/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf ->
build/lib.linux-i686-2.4/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._wxagg' extension
C compiler:
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC

compile
options: '-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -I/usr/include/libpng12 -I/usr/local/include -I/usr/include -I. -I/var/lib/python-support/python2.4/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -I/usr/include/python2.4 -c'
gcc: src/_wxagg.cpp
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
In file included from /usr/include/python2.4/Python.h:8,
                 from ./CXX/WrapPython.h:47,
                 from ./CXX/Extensions.hxx:48,
                 from src/_backend_agg.h:8,
                 from src/_wxagg.cpp:48:
/usr/include/python2.4/pyconfig.h:851:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                 
from /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring:52,
                 from src/_wxagg.cpp:38:
/usr/include/features.h:150:1: warning: this is the location of the previous
definition
src/_wxagg.cpp:55:34: error: wx/wxPython/wxPython.h: No such file or directory
src/_wxagg.cpp: In member function 'Py::Object
_wxagg_module::convert_agg_to_wx_image(const Py::Tuple&)':
src/_wxagg.cpp:103: error: 'wxPyConstructObject' was not declared in this
scope
src/_wxagg.cpp: In member function 'Py::Object
_wxagg_module::convert_agg_to_wx_bitmap(const Py::Tuple&)':
src/_wxagg.cpp:125: error: 'wxPyConstructObject' was not declared in this
scope
src/_wxagg.cpp: In function 'void init_wxagg()':
src/_wxagg.cpp:253: error: 'wxPyCoreAPI_IMPORT' was not declared in this scope
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:
At global scope:
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:943:
warning: 'int _import_array()' defined but not used
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
In file included from /usr/include/python2.4/Python.h:8,
                 from ./CXX/WrapPython.h:47,
                 from ./CXX/Extensions.hxx:48,
                 from src/_backend_agg.h:8,
                 from src/_wxagg.cpp:48:
/usr/include/python2.4/pyconfig.h:851:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                 
from /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring:52,
                 from src/_wxagg.cpp:38:
/usr/include/features.h:150:1: warning: this is the location of the previous
definition
src/_wxagg.cpp:55:34: error: wx/wxPython/wxPython.h: No such file or directory
src/_wxagg.cpp: In member function 'Py::Object
_wxagg_module::convert_agg_to_wx_image(const Py::Tuple&)':
src/_wxagg.cpp:103: error: 'wxPyConstructObject' was not declared in this
scope
src/_wxagg.cpp: In member function 'Py::Object
_wxagg_module::convert_agg_to_wx_bitmap(const Py::Tuple&)':
src/_wxagg.cpp:125: error: 'wxPyConstructObject' was not declared in this
scope
src/_wxagg.cpp: In function 'void init_wxagg()':
src/_wxagg.cpp:253: error: 'wxPyCoreAPI_IMPORT' was not declared in this scope
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:
At global scope:
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:943:
warning: 'int _import_array()' defined but not used
error:
Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -I/usr/include/libpng12 -I/usr/local/include -I/usr/include -I. -I/var/lib/python-support/python2.4/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -I/usr/include/python2.4 -c
src/_wxagg.cpp -o build/temp.linux-i686-2.4/src/_wxagg.o" failed with exit
status 1

This is a known bug in the Debian packaging of wxPython.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=326440

There are some workarounds mentioned in that post.

Personally, I usually end up building wxPython from source (which doesn't have this header file problem) to keep up with its fairly frequent bugfixes anyway. If you'd prefer to stick with deb packages, you could *try* the wxPython-provided .deb packages (i.e. not the Debian-provided ones) here, though I don't know whether they also exhibit this problem:

http://wiki.wxpython.org/InstallingOnUbuntuOrDebian

Cheers,
Mike

Matthias Michler wrote:

···

Hello list,

I was not up to date with my installation and I tried to use the latest svn version (trunk) on my Debian etch. I have a problem to build matplotlib including support for wxPython as backend. The output is attached below.

Actually I cannot find a file "wxPython.h" on my system.

Can anybody give me a hint what I'm doing wrong?
How can I find wx headers and tell their location matplotlib?

best regards and thanks in advance for any hint,
Matthias

$ python setup.py build

BUILDING MATPLOTLIB
            matplotlib: 0.98pre
                python: 2.4.4 (#2, Apr 5 2007, 20:11:18) [GCC 4.1.2
                        20061115 (prerelease) (Debian 4.1.1-21)]
              platform: linux2

REQUIRED DEPENDENCIES
                 numpy: 1.0.4
             freetype2: 9.10.3

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.15beta5
               Tkinter: Tkinter: 39220, Tk: 8.4, Tcl: 8.4
              wxPython: 2.6.3.2
                        * Could not find wxPython headers in any of
                        * '/usr/lib/wx/include/gtk2-unicode-release-2.6',
                        * '/usr/include/wx-2.6'
                  Gtk+: gtk+: 2.8.20, glib: 2.12.4, pygtk: 2.8.6, pygobject:
                        [pre-pygobject]
                    Qt: Qt: 3.3.6, PyQt: 3.16
                   Qt4: no
                 Cairo: 1.2.0

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: present, version unknown
                  pytz: 2006p

OPTIONAL USETEX DEPENDENCIES
                dvipng: 1.9
           ghostscript: 8.15.3
                 latex: 3.141592
               pdftops: 3.01

EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES
             configobj: matplotlib will provide
      enthought.traits: matplotlib will provide

[Edit setup.cfg to suppress the above messages]

running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-i686-2.4/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.linux-i686-2.4/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._wxagg' extension
C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC

compile options: '-DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -I/usr/include/libpng12 -I/usr/local/include -I/usr/include -I. -I/var/lib/python-support/python2.4/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -I/usr/include/python2.4 -c'
gcc: src/_wxagg.cpp
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
In file included from /usr/include/python2.4/Python.h:8,
                 from ./CXX/WrapPython.h:47,
                 from ./CXX/Extensions.hxx:48,
                 from src/_backend_agg.h:8,
                 from src/_wxagg.cpp:48:
/usr/include/python2.4/pyconfig.h:851:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                 from /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring:52,
                 from src/_wxagg.cpp:38:
/usr/include/features.h:150:1: warning: this is the location of the previous definition
src/_wxagg.cpp:55:34: error: wx/wxPython/wxPython.h: No such file or directory
src/_wxagg.cpp: In member function 'Py::Object _wxagg_module::convert_agg_to_wx_image(const Py::Tuple&)':
src/_wxagg.cpp:103: error: 'wxPyConstructObject' was not declared in this scope
src/_wxagg.cpp: In member function 'Py::Object _wxagg_module::convert_agg_to_wx_bitmap(const Py::Tuple&)':
src/_wxagg.cpp:125: error: 'wxPyConstructObject' was not declared in this scope
src/_wxagg.cpp: In function 'void init_wxagg()':
src/_wxagg.cpp:253: error: 'wxPyCoreAPI_IMPORT' was not declared in this scope
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h: At global scope:
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:943: warning: 'int _import_array()' defined but not used
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
In file included from /usr/include/python2.4/Python.h:8,
                 from ./CXX/WrapPython.h:47,
                 from ./CXX/Extensions.hxx:48,
                 from src/_backend_agg.h:8,
                 from src/_wxagg.cpp:48:
/usr/include/python2.4/pyconfig.h:851:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                 from /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/cstring:52,
                 from src/_wxagg.cpp:38:
/usr/include/features.h:150:1: warning: this is the location of the previous definition
src/_wxagg.cpp:55:34: error: wx/wxPython/wxPython.h: No such file or directory
src/_wxagg.cpp: In member function 'Py::Object _wxagg_module::convert_agg_to_wx_image(const Py::Tuple&)':
src/_wxagg.cpp:103: error: 'wxPyConstructObject' was not declared in this scope
src/_wxagg.cpp: In member function 'Py::Object _wxagg_module::convert_agg_to_wx_bitmap(const Py::Tuple&)':
src/_wxagg.cpp:125: error: 'wxPyConstructObject' was not declared in this scope
src/_wxagg.cpp: In function 'void init_wxagg()':
src/_wxagg.cpp:253: error: 'wxPyCoreAPI_IMPORT' was not declared in this scope
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h: At global scope:
/var/lib/python-support/python2.4/numpy/core/include/numpy/__multiarray_api.h:943: warning: 'int _import_array()' defined but not used
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -I/usr/include/libpng12 -I/usr/local/include -I/usr/include -I. -I/var/lib/python-support/python2.4/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/include/freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -I/usr/include/python2.4 -c src/_wxagg.cpp -o build/temp.linux-i686-2.4/src/_wxagg.o" failed with exit status 1

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

The wxPython Debian packages do not include the development headers required to build the WXAgg accelerator module. The WXAgg backend will work just fine without it, so you should disable the module by editing setup.cfg and uncommenting the line "wxagg = False" in the "gui_support" section.

Please let me know if you haven't created a setup.cfg file and are receiving this error straight "out of the box", as that's indicative of a bug in the build system. Thanks!

Ken

···

On Jan 22, 2008, at 11:00 AM, Matthias Michler wrote:

I was not up to date with my installation and I tried to use the latest svn
version (trunk) on my Debian etch. I have a problem to build matplotlib
including support for wxPython as backend. The output is attached below.

Actually I cannot find a file "wxPython.h" on my system.

Hello Ken,
Hello Mike,
Hello all,

> I was not up to date with my installation and I tried to use the
> latest svn
> version (trunk) on my Debian etch. I have a problem to build
> matplotlib
> including support for wxPython as backend. The output is attached
> below.
>
> Actually I cannot find a file "wxPython.h" on my system.

The wxPython Debian packages do not include the development headers
required to build the WXAgg accelerator module. The WXAgg backend
will work just fine without it, so you should disable the module by
editing setup.cfg and uncommenting the line "wxagg = False" in the
"gui_support" section.

Please let me know if you haven't created a setup.cfg file and are
receiving this error straight "out of the box", as that's indicative
of a bug in the build system. Thanks!

First of all thanks a lot for your (Mike and Ken) suggestions. I will try it
later that day.
I'm quite sure I did not create a setup.cfg file before this error message
occured the first time. I deleted my setup.cfg and the error message seems
quite similar (it is attached).

thanks again for your help, best regards
Matthias

error_message.txt (5.84 KB)

···

On Tuesday 22 January 2008 19:33, Ken McIvor wrote:

On Jan 22, 2008, at 11:00 AM, Matthias Michler wrote:

Just another note:

If you can use wxPython 2.8.*, then this problem should go away. 2.8 added some methods that allow more directly moving bitmaps from Agg to wxPython, eliminating the need for any extension code.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...