FAQ
Hi All,

I'm trying to setup matplotlib (http://matplotlib.sourceforge.net/) in
a Win XP box.

I have two questions:

1. How do I install the GD Lib (http://www.boutell.com/gd)? The zip
contains a compiled dll. Is it enough to put it in /Windows/System32?

2. The python interface to GD at
http://newcenturycomputers.net/projects/gdmodule.html (gdmodule) has a
setup.py script for Linux systems. Is there any windows/multiplatfor
version? I tried to hack it including the /Windows/systm32 dir in the
libdirs variables and renaming the dll file to gd.dll, but the script
doesn't work either.

Thank you in advance.

Ed.

Search Discussions

  • John Hunter at Feb 2, 2004 at 11:24 pm
    "Eduardo" == Eduardo Elgueta <eelgueta at navix.cl> writes:
    Eduardo> Hi All, I'm trying to setup matplotlib
    Eduardo> (http://matplotlib.sourceforge.net/) in a Win XP box.

    gdmodule is difficult to install on windows (as you've discovered).
    Fortunately, Stefan Kuzminski figured this out and built a statically
    linked gd module - no need to download gd lib or freetype, etc. Here
    are the compile notes he posted to the matplotlib-users mailing list

    http://sourceforge.net/mailarchive/message.php?msg_idp64914

    and here is a link to the dll; just put this in your site-packages dir.

    http://matplotlib.sourceforge.net/gd/_gd.dll

    You will also need to place gd.py from the gdmodule-0.51 distro in
    site-packages. After that you should be able to do
    python
    import gd
    IMPORTANT - I've been doing a lot of development on the gd backend of
    late and the latest version of matplotlib requires a patched version
    of gdmodule (which will become included in the standard gdmodule at
    the next release). So the DLL linked above *will not* work with
    matplotlib-0.50. Thus you will need to either:

    * downgrade to matplotlib-0.42.2 -
    http://sourceforge.net/project/showfiles.php?group_id�706

    * build the patched gdmodule using
    http://matplotlib.sourceforge.net/gd/_gdmodule.c. If you do
    this, you can take advantage of the improvements made in the gd
    backend subsequent to 0.42.2. Please mail me a copy of the DLL
    if you succeed with any compile notes.

    Of course you still need to the prerequisites described on
    http://matplotlib.sourceforge.net/backends.html#GD, but gdmodule is
    definitely the tough nut to crack on win32.

    I haven't built fonttools for win32 in some time, so if someone else
    can pipe in and share their insights I'd be happy. I found the TTX
    installer on the sourceforge site, but this doesn't seem to provide
    the python fontools package.

    With the prereqs installed, you can test your setup with

    import matplotlib
    matplotlib.use('GD')
    from matplotlib.matlab import *
    plot([1,2,3])
    savefig('gdtest')

    Good luck!
    John Hunter
  • Eduardo Elgueta at Feb 3, 2004 at 1:40 pm
    John,

    Thank you very much for such a complete answer.

    I'll try it and let you now if I succeed building the patched gdmodule.

    Best regards,

    Ed.

    <cita quien="John Hunter">
    "Eduardo" == Eduardo Elgueta <eelgueta at navix.cl> writes:
    Eduardo> Hi All, I'm trying to setup matplotlib
    Eduardo> (http://matplotlib.sourceforge.net/) in a Win XP box.

    gdmodule is difficult to install on windows (as you've discovered).
    Fortunately, Stefan Kuzminski figured this out and built a statically
    linked gd module - no need to download gd lib or freetype, etc. Here
    are the compile notes he posted to the matplotlib-users mailing list

    http://sourceforge.net/mailarchive/message.php?msg_idp64914

    and here is a link to the dll; just put this in your site-packages dir.

    http://matplotlib.sourceforge.net/gd/_gd.dll

    You will also need to place gd.py from the gdmodule-0.51 distro in
    site-packages. After that you should be able to do
    python
    import gd
    IMPORTANT - I've been doing a lot of development on the gd backend of
    late and the latest version of matplotlib requires a patched version
    of gdmodule (which will become included in the standard gdmodule at
    the next release). So the DLL linked above *will not* work with
    matplotlib-0.50. Thus you will need to either:

    * downgrade to matplotlib-0.42.2 -
    http://sourceforge.net/project/showfiles.php?group_id�706

    * build the patched gdmodule using
    http://matplotlib.sourceforge.net/gd/_gdmodule.c. If you do
    this, you can take advantage of the improvements made in the gd
    backend subsequent to 0.42.2. Please mail me a copy of the DLL
    if you succeed with any compile notes.

    Of course you still need to the prerequisites described on
    http://matplotlib.sourceforge.net/backends.html#GD, but gdmodule is
    definitely the tough nut to crack on win32.

    I haven't built fonttools for win32 in some time, so if someone else
    can pipe in and share their insights I'd be happy. I found the TTX
    installer on the sourceforge site, but this doesn't seem to provide
    the python fontools package.

    With the prereqs installed, you can test your setup with

    import matplotlib
    matplotlib.use('GD')
    from matplotlib.matlab import *
    plot([1,2,3])
    savefig('gdtest')

    Good luck!
    John Hunter

    --
    Eduardo Elgueta
    Senior Consultant
    Navix

    correo/email: eelgueta at navix.cl
    tel?fono/phone: +56 (2) 209-8905
    celular/mobile: +56 (9) 821-0033
    web: www.navix.cl

    Av. Pedro de Valdivia 555 Of. 216
    Providencia 750-0913
    Santiago, Chile
  • John Hunter at Feb 3, 2004 at 4:50 pm
    "Eduardo" == Eduardo Elgueta <eelgueta at navix.cl> writes:
    Eduardo> John, Thank you very much for such a complete answer.

    Eduardo> I'll try it and let you now if I succeed building the
    Eduardo> patched gdmodule.

    That would be great. In the mean time, I have two more pieces of
    advice

    There is a strange bug that Stefan discovered when saving some images
    on win32. You need to change the line in
    matplotlib.backends.backend_gd.print_figure from

    im.writePng( file(filename, 'wb') )
    to
    im.writePng( filename )

    Also, if you need windows installers for fonttools, I built them last
    night for python2.2 and python2.3. Let me know and I'll send you one.

    I'd like to add a section 'building GD on win32' to the website, so
    let me know if you have anything to add to that.

    JDH
  • Eduardo Elgueta at Feb 3, 2004 at 8:44 pm
    John,

    Ok. See you around.

    Ed.

    <cita quien="John Hunter">
    "Eduardo" == Eduardo Elgueta <eelgueta at navix.cl> writes:
    Eduardo> John, Thank you very much for such a complete answer.

    Eduardo> I'll try it and let you now if I succeed building the
    Eduardo> patched gdmodule.

    That would be great. In the mean time, I have two more pieces of
    advice

    There is a strange bug that Stefan discovered when saving some images
    on win32. You need to change the line in
    matplotlib.backends.backend_gd.print_figure from

    im.writePng( file(filename, 'wb') )
    to
    im.writePng( filename )

    Also, if you need windows installers for fonttools, I built them last
    night for python2.2 and python2.3. Let me know and I'll send you one.

    I'd like to add a section 'building GD on win32' to the website, so
    let me know if you have anything to add to that.

    JDH

    --
    Eduardo Elgueta
    Senior Consultant
    Navix

    correo/email: eelgueta at navix.cl
    tel?fono/phone: +56 (2) 209-8905
    celular/mobile: +56 (9) 821-0033
    web: www.navix.cl

    Av. Pedro de Valdivia 555 Of. 216
    Providencia 750-0913
    Santiago, Chile



    From sdfATexpertuneDOTcom Tue Feb 3 22:27:17 2004
    From: sdfATexpertuneDOTcom (Scott F)
    Date: Tue, 03 Feb 2004 21:27:17 -0000
    Subject: OT: Recommended news reader?
    References: <4f0a9fdb.0402031309.fde7220@posting.google.com>
    Message-ID: <Xns94849D377F5B0sdfexpertunecom@216.168.3.44>

    miki.tebeka at zoran.com (Miki Tebeka) wrote in
    news:4f0a9fdb.0402031309.fde7220 at posting.google.com:
    Which news reader do you recommend?
    Currently I use Google Groups and find it a bit to dull.
    On Windows, try Xnews.

    http://xnews.newsguy.com/
  • Kevin Dahlhausen at Feb 3, 2004 at 8:16 pm
    I just went through a similar process in getting a native 2.3 version
    of the jpgraph charting library to build on windows. While not
    exactly, the same, I hope these notes will help you out.

    Things build fairly straightforward using MINGW and MINSYS to build
    the python extentions. The process is went like this:

    Install MINGW and MINSYS

    Run dll tool on Python23 to make libpython23.a:
    [from: http://sebsauvage.net/python/mingw.html)
    pexports python23.dll > python23.def
    (get it from http://starship.python.net/crew/kernr/mingw32/pexports-0.42h.zip)
    dlltool --dllname python23.dll --def python23.def --output-lib
    libpython23.a
    Copy libpython23.a to c:\python23\libs\
    ]


    Then for each module, one at a time, perform the following sequence:

    Untar the source archive.
    Open a minsys window and do a compile. Config generally works when
    they have them. Other changes are to add the python include dir to
    CFLAGS and to add python23 to the linker libs and the python 'libs'
    dir to the LD library path.
    Copy all the resulting "lib*.a" files to C:\mingw\lib (adjusting for
    your installation of course!).
    Inspect the makefile install target to determine what ".h" files
    should be copied. Copy these over to c:\mingw\include.
    For python modules, copy the .pyd files to your python home
    \lib\site-packages directory.

    After some trial and error, I found I had to build the modules in the
    following order:

    freetype-2.1.5
    zlib-1.2.1
    libpng-1.2.5
    jpeg-6b
    gd-1.8.4
    gdmodule-0.26
    jpgraph-1.5.3

    I'm sure there's room for improvement, for example make install might
    have worked. I didn't really care about the amount of manual copying
    in this process as I just wanted the resulting python library.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedFeb 2, '04 at 10:35p
activeFeb 3, '04 at 8:44p
posts6
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase