building from source on Windows

Hello everyone,

I'm trying to get 0.98.5.2 installed on Windows to use Python 2.6 (dependency packages I need to use on that version, long story, etc).

When I was trying to build it (python setup.py build), it was finding the VC 9.0 C++ compiler on my comp. However, after adding necessary packages (zlib, png, etc), it was reporting missing 'unistd.h'. Clearly, this means it was meant to be built with GCC for Windows like MinGW ?

I have uninstalled the VC compiler, installed GnuWin32 packages and tried using MinGW (passing --compiler=mingw32 to python setup.py build ) but now compilation process fails like this:

c:\MinGW\bin\g++.exe -mno-cygwin -shared -s build\temp.win32-2.6\Release\src\ft2font.o build\temp.wi
n32-2.6\Release\src\mplutils.o build\temp.win32-2.6\Release\cxx\cxxsupport.o build\temp.win32-2.6\Re
lease\cxx\cxx_extensions.o build\temp.win32-2.6\Release\cxx\indirectpythoninterface.o build\temp.win
32-2.6\Release\cxx\cxxextensions.o build\temp.win32-2.6\Release\src\ft2font.def -LC:\Python26\libs -
LC:\Python26\PCbuild -lfreetype -lz -lgw32c -lstdc++ -lm -lpython26 -lmsvcr90 -o build\lib.win32-2.6
\matplotlib\ft2font.pyd
c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lgw32c
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1

What the heck is lgw32c??

Regards,
mk

Greetings,

Did you download the win32_static folder and place it in the top level
of the matplotlic source?

I had similar problems building on my windows machine until I did this
and now it works fine. You might also check all the README documents,
as one of them gives you more information about building for windows.

-Patrick

···

On Mon, Jan 26, 2009 at 8:17 AM, Marcin Krol <mrkafk@...287...> wrote:

Hello everyone,

I'm trying to get 0.98.5.2 installed on Windows to use Python 2.6
(dependency packages I need to use on that version, long story, etc).

When I was trying to build it (python setup.py build), it was finding
the VC 9.0 C++ compiler on my comp. However, after adding necessary
packages (zlib, png, etc), it was reporting missing 'unistd.h'. Clearly,
this means it was meant to be built with GCC for Windows like MinGW ?

I have uninstalled the VC compiler, installed GnuWin32 packages and
tried using MinGW (passing --compiler=mingw32 to python setup.py build )
but now compilation process fails like this:

c:\MinGW\bin\g++.exe -mno-cygwin -shared -s
build\temp.win32-2.6\Release\src\ft2font.o build\temp.wi
n32-2.6\Release\src\mplutils.o
build\temp.win32-2.6\Release\cxx\cxxsupport.o build\temp.win32-2.6\Re
lease\cxx\cxx_extensions.o
build\temp.win32-2.6\Release\cxx\indirectpythoninterface.o build\temp.win
32-2.6\Release\cxx\cxxextensions.o
build\temp.win32-2.6\Release\src\ft2font.def -LC:\Python26\libs -
LC:\Python26\PCbuild -lfreetype -lz -lgw32c -lstdc++ -lm -lpython26
-lmsvcr90 -o build\lib.win32-2.6
\matplotlib\ft2font.pyd
c:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
cannot find -lgw32c
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1

What the heck is lgw32c??

Regards,
mk

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

Hello Patrick,

I had similar problems building on my windows machine until I did this
and now it works fine. You might also check all the README documents,
as one of them gives you more information about building for windows.

I followed the instructions from README in win32_static precisely. This created file libpython26.a fine, etc. The build and installation process finished fine.

However, when I try to do now

>>> import matplotlib
>>> from pylab import *

I get:

Traceback (most recent call last):
   File "<pyshell#1>", line 1, in <module>
     from pylab import *
   File "C:\Python26\Lib\site-packages\pylab.py", line 1, in <module>
     from matplotlib.pylab import *
   File "c:\Python26\Lib\site-packages\matplotlib\pylab.py", line 206, in <module>
     from matplotlib import mpl # pulls in most modules
   File "c:\Python26\Lib\site-packages\matplotlib\mpl.py", line 1, in <module>
     from matplotlib import artist
   File "c:\Python26\Lib\site-packages\matplotlib\artist.py", line 5, in <module>
     from transforms import Bbox, IdentityTransform, TransformedBbox, TransformedPath
   File "c:\Python26\Lib\site-packages\matplotlib\transforms.py", line 34, in <module>
     from matplotlib._path import affine_transform
ImportError: DLL load failed: The specified procedure could not be found.

Regards,
mk

Hi Marcin,

I didn't catch on the first email you were trying to build for
python2.6. I haven't been able to get matplotlib to build correctly
with python2.6. I'm actually curious as to how you were able to build
matplotlib using the win32_static folder since it doesn't contain the
libs and header files for tcl/tk 8.5 which python2.6 is build against.
This was the original error for me and I had to modify the
setupext.py to look for the tcl/tk 8.5 includes (which I had to
manually add to win32_static). What happens if you try:

import matplotlib.pyplot as plt
x = range(0,100)
y = range(0,100)
plt.plot(x,y)
plt.show()

As for the error you specifically mentioned, have you checked to make
sure that the correct dll exists? This error typically happens to me
when the dll didn't build properly (if at all).

···

--
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com

Hello Patrick,

Thanks for reply!

I didn't catch on the first email you were trying to build for
python2.6. I haven't been able to get matplotlib to build correctly
with python2.6. I'm actually curious as to how you were able to build
matplotlib using the win32_static folder since it doesn't contain the
libs and header files for tcl/tk 8.5 which python2.6 is build against.

I didn't do anything really, except I have had installed Python 2.5 on the same system before. Maybe this left DLLs lying around and the compiled matplotlib uses those old DLLs?

This was the original error for me and I had to modify the
setupext.py to look for the tcl/tk 8.5 includes (which I had to
manually add to win32_static). What happens if you try:

import matplotlib.pyplot as plt
x = range(0,100)
y = range(0,100)
plt.plot(x,y)
plt.show()

I have used win32_static_vs (I have VC++ 9.0 installed) and it just worked! It displayed the graph and everything.

As for the error you specifically mentioned, have you checked to make
sure that the correct dll exists? This error typically happens to me
when the dll didn't build properly (if at all).

How do I do that? After this successful build, I can't find any DLL in the 'build' folder. I have unpacked matplotlib-0.98.5.2.win32-py2.6.exe installer and it doesn't contain any dll either.

Regards,
mk

It might help if you recursively remove the buld directory, do a clean
rebuld, capture the build output in a file, and post that here so we
can see if we can get an idea what is going on

···

On Tue, Jan 27, 2009 at 4:31 AM, Marcin Krol <mrkafk@...287...> wrote:

Hello Patrick,

Thanks for reply!

I didn't catch on the first email you were trying to build for
python2.6. I haven't been able to get matplotlib to build correctly
with python2.6. I'm actually curious as to how you were able to build
matplotlib using the win32_static folder since it doesn't contain the
libs and header files for tcl/tk 8.5 which python2.6 is build against.

I didn't do anything really, except I have had installed Python 2.5 on
the same system before. Maybe this left DLLs lying around and the
compiled matplotlib uses those old DLLs?

This was the original error for me and I had to modify the
setupext.py to look for the tcl/tk 8.5 includes (which I had to
manually add to win32_static). What happens if you try:

import matplotlib.pyplot as plt
x = range(0,100)
y = range(0,100)
plt.plot(x,y)
plt.show()

I have used win32_static_vs (I have VC++ 9.0 installed) and it just
worked! It displayed the graph and everything.

As for the error you specifically mentioned, have you checked to make
sure that the correct dll exists? This error typically happens to me
when the dll didn't build properly (if at all).

How do I do that? After this successful build, I can't find any DLL in
the 'build' folder. I have unpacked matplotlib-0.98.5.2.win32-py2.6.exe
installer and it doesn't contain any dll either.

John Hunter wrote:

It might help if you recursively remove the buld directory, do a clean
rebuld, capture the build output in a file, and post that here so we
can see if we can get an idea what is going on

Since it's over 250kB, I pasted it here:

Regards,
mk

First of all, on the clean build, when you do

  import matplotlib._path

do you still get the same error.

I don't know a ton about windows and even less about visual studio,
but according to the build output you posted a _path.pyd file is built
and apparently installed. It may be that it is trying to linking
against some dll that is not on your system. There is a windows
freeware program I used to use to debug this stuff, in which you could
load the pyd file and see what it links against, which reported
failures. Perhaps a windows guru can advise here.

In the past, there was a bug in distutils that was forcing the
compiler to link against msvcp71.dll which could be fixed by patching
distutils. Don't know if this is related

···

On Tue, Jan 27, 2009 at 7:09 AM, Marcin Krol <mrkafk@...287...> wrote:

John Hunter wrote:

It might help if you recursively remove the buld directory, do a clean
rebuld, capture the build output in a file, and post that here so we
can see if we can get an idea what is going on

Since it's over 250kB, I pasted it here:

mk - Pastebin.com

John Hunter wrote:

First of all, on the clean build, when you do

  import matplotlib._path

do you still get the same error.

No, it's working fine on the new build (the import above and the whole installation0 -- once I switched to VC++ from MinGW.

<snip info, ack>

Regards,
mk

I figured out why your show() works...you had WxPython installed and
I'm assuming your backend was defaulting to this since Tkinter wasn't
found. Once I noticed that I installed WxPython and then re-buily
matplotlib with WxPython. If I used wxpython as my backend, then my
GUIs worked. I can import pylab just fine and I don't appear to have
any errors. While I can't figure out what your problem is, you are
free to try the binary I built and see if it works:
http://code.patricktmarsh.com/matplotlib-0.98.6svn.win32-py2.6.exe

If you do decide to try this, let me know if it works.

-Patrick

···

On Tue, Jan 27, 2009 at 9:22 AM, Marcin Krol <mrkafk@...287...> wrote:

John Hunter wrote:

First of all, on the clean build, when you do

  import matplotlib._path

do you still get the same error.

No, it's working fine on the new build (the import above and the whole
installation0 -- once I switched to VC++ from MinGW.

<snip info, ack>

Regards,
mk

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
Patrick Marsh
Graduate Research Assistant
School of Meteorology
University of Oklahoma
http://www.patricktmarsh.com