Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
2010/5/25 Pim Schellart p.schell...@gmail.com: I tried both and although it now seems to find the libraries it still fails to link something. src/_png.cpp:293: error: ‘png_infopp_NULL’ was not declared in this scope src/_png.cpp:293: error: ‘png_infopp_NULL’ was not declared in this scope I compiled matplotlib-0.99.1.2 just yesterday fine on Snow Leopard from source without being aware of make.osx (with freetype2-2.3.12, libpng-1.4.1). The problem I'm citing here, which seems to be actually also your problem, is due to an API change in linbpng from 1.3 to 1.4. I soon ago pointed this out on the list but there were no responses. One can add #defines for the missing things in src/_png.cpp to fix it. I don't know if you would run into some more problems but this one is solvable. But I also modified setupext.py to find my libraries in /usr/local. Friedrich -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
Dear Friedrich, sorry for the confusion. It may very well be that I misinterpreted part of the problem as I am no expert either. The problem came to be as follows. At first I used the binaries for the latest stable releases of Python 2.6 + numpy + matplotlib from the respected websites. But in order to compile a custom library I needed Python to be compiled 64 bit. This worked for Python, numpy and scipy but not for matplotlib. I used to be able to compile matplotlib with a simple sudo python setup.py install but when I tried to do this after the change to 64 bit the build failed with some errors which seemed to me to be related to freetype not being compiled 64 bit (these errors, which I unfortunately did not save clearly indicated that the linker could not find some symbols and when I checked the architecture of the libs it was i386 only). I tried to fix this by first compiling freetype 64 bit, and later libpng as well. The problem now was that setupext.py did not look in the right location for my new libpng build. After I installed pkgtool this was also solved, however now the reported error occurred. I also could not use the make.osx script from the latest svn checkout because of a bug in the fetching of zlib which John fixed. Finally removing my custom installations of freetype and libpng and using make.osx to fetch and build them solved the problem. Oh and somewhere in all this mess I also managed to build it but then got a malloc error when loading so I tried the removing of i386 but this did not solve the problem so I changed it back. I guess the conclusion is that the current svn works, but only with the make.osx approach. If I had the time I would try it again on a fresh install to see where the bug is that prevents setup.py from working with a custom compiled freetype and libpng but for now I am happy that it finally works :) Kind regards, Pim Schellart 2010/5/27 Friedrich Romstedt friedrichromst...@gmail.com: 2010/5/27 Pim Schellart p.schell...@gmail.com: thank you for the tip, I'll try and see if the stable release works as well with this adjustment. The problem however was not just in compiling on Snow Leopard, but compiling specifically against a custom compiled 64 bit only version of python. This now works with the make.osx file and the latest svn release, although I agree this is an ugly solution and would prefer the same build system on every OS. Pim, I must confess that I'm lost a bit in all this details and all this patches ... I hope that I'm not alone with this ... Can you maybe give a short summary on the list? First I don't understand why you compiled a 64 bit only version of your Python. I.e., what am I missing, when I compile my Python 2.6 the usual way? (I also have a 64 bit machine.) Then, your first error seems to originate from: src/ft2font.h:13:22: error: ft2build.h: No such file or directory I don't know, but I guess it's due to not finding the correct include directory for you self-compiled freetype2? If it is like this, I fixed it in setupext.py (the darwin section, not the darwin_ section). The search path list is empty for darwin, and I added /usr/local into it. Actually I don't remember precisely what the error was making me fixing this ... And it's true, I simply ignored the # So I'm pointing to ... comment in setupext.py ... Then the next error you reported was clearly related to libpng API change, so again nothing with 32/64 bit issues. So, I don't understand your conclusion that at all you have problems due to your 64bit-only built Python? Sorry, maybe I miss something obvious? I think people have been trusting you that it's a 64bit issue, and gave suggestions based on that, but maybe it isn't at all? Just a whacky thought! I simply cannot find an error pointing towards this root! I now went throught it again finally, and I found that magically John mentioned his work for 64bit Python on the make.osx file, and then there was some remove all -arch i386 recommendation, but it's all a bit unclear to me ... Sorry, I'm not an expert at all, my intention is just to track the problem /not to the false root/ down. My explanation is: You downloaded by using make.osx an older version of libpng (1.2) and additionally a freetype version in local directory, so all the -Is are working respectively. This solved both your freetype problem and your libpng problem. I need some advice what else was solved by make.osx? Of course this path is good for creating binaries with libpng and freetype2 hardlinked, but I don't see the clue for your case. Friedrich -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
Dear Pim, 2010/5/27 Pim Schellart p.schell...@gmail.com: At first I used the binaries for the latest stable releases of Python 2.6 + numpy + matplotlib from the respected websites. But in order to compile a custom library I needed Python to be compiled 64 bit. For me this was the same with PIL ... though I didn't need 64bit for that. And I agree, for a new Mac user it's a mess. This worked for Python, numpy and scipy but not for matplotlib. I used to be able to compile matplotlib with a simple sudo python setup.py install but when I tried to do this after the change to 64 bit the build failed with some errors which seemed to me to be related to freetype not being compiled 64 bit (these errors, which I unfortunately did not save clearly indicated that the linker could not find some symbols and when I checked the architecture of the libs it was i386 only). I tried to fix this by first compiling freetype 64 bit, and later libpng as well. The problem now was that setupext.py did not look in the right location for my new libpng build. After I installed pkgtool this was also solved, however now the reported error occurred. And this error was due to the API change. I also could not use the make.osx script from the latest svn checkout because of a bug in the fetching of zlib which John fixed. Finally removing my custom installations of freetype and libpng and using make.osx to fetch and build them solved the problem. Oh and somewhere in all this mess I also managed to build it but then got a malloc error when loading so I tried the removing of i386 but this did not solve the problem so I changed it back. This I don't understand. I guess the conclusion is that the current svn works, but only with the make.osx approach. I cannot agree currently. I can try to do my first contact with svn, but for the stable release, it works as said before with some tweaking in setupext.py and src/_png.cpp too. Also we seem to have quite similar machines and prerequisites. The setupext.py tweak may be omittable by using pkgtool. So my conclusion is that with using pkgtool and the change in src/_png.cpp matplotlib should be buildable from sources with setup.py. John, shouldn't we finally fix this ugly src/_png.cpp problem? More and more people run into problems when using the recent libpng-1.4. The lines to be added to _png.cpp are: #define png_infopp_NULL (png_infopp)NULL #define int_p_NULL (int*)NULL Maybe libpng defines some constant to make use of in determining whether the build is with libpng-1.2 or 1.4. If I had the time I would try it again on a fresh install to see where the bug is that prevents setup.py from working with a custom compiled freetype and libpng but for now I am happy that it finally works :) I can understand you and I'm facing the same problem. Friedrich -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
Hi John and George, I did of course rtfm :) However when I do this for the latest svn checkout I get: matplotlib $ PREFIX=/usr/local sudo make -f make.osx fetch deps mpl_install Password: python2.6 -c 'import urllib; urllib.urlretrieve(http://www.zlib.net/zlib-1.2.3.tar.gz;, zlib-1.2.3.tar.gz)' \ python2.6 -c 'import urllib; urllib.urlretrieve(http://downloads.sourceforge.net/project/libpng/libpng-stable/1.2.39/libpng-1.2.39.tar.gz;, libpng-1.2.39.tar.gz)' \ python2.6 -c 'import urllib; urllib.urlretrieve(http://download.savannah.gnu.org/releases/freetype/freetype-2.3.11.tar.bz2;, freetype-2.3.11.tar.bz2)' export PKG_CONFIG_PATH=/lib/pkgconfig \ rm -rf zlib-1.2.3 \ tar xvfj zlib-1.2.3.tar.gz \ cd zlib-1.2.3 \ export MACOSX_DEPLOYMENT_TARGET=10.6 \ export CFLAGS=-arch i386 -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk \ export LDFLAGS=-arch i386 -arch x86_64 -L/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk \ ./configure --prefix=\ MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=-arch i386 -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk LDFLAGS=-arch i386 -arch x86_64 -L/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk make -j3 install \ unset MACOSX_DEPLOYMENT_TARGET tar: Unrecognized archive format: Inappropriate file type or format tar: Error exit delayed from previous errors. make: *** [zlib] Error 1 However I would prefer to use my independently installed freetype2 and libpng libraries, rather than installing them again. Does anyone have an idea where the architecture error comes from, or how to check this? Also, why is a separate make.osx file needed? Could the same functionality not have been integrated into the setup.py script? This is not a rant, just a question :) Kind regards, Pim Schellart 2010/5/25 George Nurser gnur...@gmail.com: If what John suggests doesn't work, and you really only need 64 bit, then the nuclear option is to remove all occurrences of -arch i386 from the makefile (assuming you have a framework build) at /Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/config/Makefile This should only generate x86_64. Obviously, save the current one, so you can go back to it. HTH, George. On 25 May 2010 16:58, John Hunter jdh2...@gmail.com wrote: On Tue, May 25, 2010 at 10:45 AM, Pim Schellart p.schell...@gmail.com wrote: Hi John and George, I tried both and although it now seems to find the libraries it still fails to link something. matplotlib-0.99.1.1 $ sudo python setup.py install According to the README I pointed you too, this isn't the command you should be running. Rather, Example usage:: PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_install But I advise you work from the svn trunk if you want to go this route, as I have made some updates for 64bit/python2.6 OSX there svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
On Wed, May 26, 2010 at 5:18 AM, Pim Schellart p.schell...@gmail.com wrote: Hi John and George, I did of course rtfm :) However when I do this for the latest svn checkout I get: matplotlib $ PREFIX=/usr/local sudo make -f make.osx fetch deps mpl_install Password: python2.6 -c 'import urllib; urllib.urlretrieve(http://www.zlib.net/zlib-1.2.3.tar.gz;, zlib-1.2.3.tar.gz)' \ python2.6 -c 'import urllib; urllib.urlretrieve(http://downloads.sourceforge.net/project/libpng/libpng-stable/1.2.39/libpng-1.2.39.tar.gz;, libpng-1.2.39.tar.gz)' \ python2.6 -c 'import urllib; urllib.urlretrieve(http://download.savannah.gnu.org/releases/freetype/freetype-2.3.11.tar.bz2;, freetype-2.3.11.tar.bz2)' export PKG_CONFIG_PATH=/lib/pkgconfig \ rm -rf zlib-1.2.3 \ tar xvfj zlib-1.2.3.tar.gz \ cd zlib-1.2.3 \ export MACOSX_DEPLOYMENT_TARGET=10.6 \ export CFLAGS=-arch i386 -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk \ export LDFLAGS=-arch i386 -arch x86_64 -L/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk \ ./configure --prefix=\ MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=-arch i386 -arch x86_64 -I/include -I/include/freetype2 -isysroot /Developer/SDKs/MacOSX10.6.sdk LDFLAGS=-arch i386 -arch x86_64 -L/lib -syslibroot,/Developer/SDKs/MacOSX10.6.sdk make -j3 install \ Looks like a bug in the makefile -- when un-tarring zlib, it should be 'tar xvfz' not 'tar xvfj'. I was recently tinkering with bz bs gz files and looks like the flags got out of whack. I've patched this in svn so you can 'svn up' and try again. unset MACOSX_DEPLOYMENT_TARGET tar: Unrecognized archive format: Inappropriate file type or format tar: Error exit delayed from previous errors. make: *** [zlib] Error 1 However I would prefer to use my independently installed freetype2 and libpng libraries, rather than installing them again. Does anyone have an idea where the architecture error comes from, or how to check this? Also, why is a separate make.osx file needed? Could the same functionality not have been integrated into the setup.py script? This is not a rant, just a question :) You could hack through make.osx to find your own libs. We do it this way to build distributable binaries where we can't count on targets having the right png/freetype on their os x systems. distutils is limited as a configure system so it is difficult to hack this kind of stuff into setup.py. Not that what we are doing is ideal, but we have been striving for works over perfect. The former is hard enough on OS X. Any improvements you can make to make this more general are of course welcome. JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
On Wed, May 26, 2010 at 10:47 AM, Pim Schellart p.schell...@gmail.com wrote: Dear John and George, I am happy to report that everything is now working! The latest SVN patch fixed the fetch problem and a complete removal of my custom compiled libpng and libfreetype2 followed by: sudo make -f make.osx fetch deps mpl_build mpl_install sudo python setup.py install did the rest. Thank you for all your help! Kind regards, Pim Schellart P.S. I am looking forward to seeing 64 binaries for Python 2.6/2.7 and numpy/scipy/matplotlib on OSX 10.6 at some point in the future :) Well, now you can make them yourself :-) make -f make.osx binaries But we will try to get some official ones out in the near future. JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
Hi, Installing pkg-config sorted things out for me. http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz --George. On 25 May 2010 16:03, Pim Schellart p.schell...@gmail.com wrote: Hi Everyone, I am attempting to compile matplotlib against a 64 bit version of Python 2.6 compiled and installed from source on OSX 10.6 (Snow Leopard). Numpy, scipy, freetype2 and libpng have been installed and work just fine, however I cannot get matplotlib to compile correctly. I get the following output: matplotlib-0.99.1.1 $ sudo python setup.py install BUILDING MATPLOTLIB matplotlib: 0.99.1.1 python: 2.6.5 (r265:79063, May 25 2010, 11:45:36) [GCC 4.2.1 (Apple Inc. build 5659)] platform: darwin REQUIRED DEPENDENCIES numpy: 1.4.1 freetype2: found, but unknown version (no pkg-config) * WARNING: Could not find 'freetype2' headers in any * of '.', './freetype2'. OPTIONAL BACKEND DEPENDENCIES libpng: found, but unknown version (no pkg-config) * Could not find 'libpng' headers in any of '.' Tkinter: Tkinter: 73770, Tk: 8.5, Tcl: 8.5 wxPython: no * wxPython not found Gtk+: no * Building for Gtk+ requires pygtk; you must be able * to import gtk in your build/install environment Mac OS X native: yes Qt: no Qt4: no Cairo: no OPTIONAL DATE/TIMEZONE DEPENDENCIES datetime: present, version unknown dateutil: matplotlib will provide pytz: matplotlib will provide adding pytz OPTIONAL USETEX DEPENDENCIES dvipng: 1.12 ghostscript: 8.70 latex: 3.1415926 [Edit setup.cfg to suppress the above messages] pymods ['pylab'] packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil/zoneinfo'] running install running build running build_py copying lib/matplotlib/mpl-data/matplotlibrc - build/lib.macosx-10.6-intel-2.6/matplotlib/mpl-data copying lib/matplotlib/mpl-data/matplotlib.conf - build/lib.macosx-10.6-intel-2.6/matplotlib/mpl-data running build_ext building 'matplotlib.ft2font' extension gcc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DPY_ARRAYAUNIQUE_SYMBOL=MPL_ARRAY_API -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include -I. -I/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/core/include/freetype2 -I./freetype2 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/ft2font.cpp -o build/temp.macosx-10.6-intel-2.6/src/ft2font.o cc1plus: warning: command line option -Wstrict-prototypes is valid for C/ObjC but not for C++ In file included from src/ft2font.cpp:1: src/ft2font.h:13:22: error: ft2build.h: No such file or directory src/ft2font.h:14:10: error: #include expects FILENAME or FILENAME src/ft2font.h:15:10: error: #include expects FILENAME or FILENAME src/ft2font.h:16:10: error: #include expects FILENAME or FILENAME src/ft2font.h:17:10: error: #include expects FILENAME or FILENAME src/ft2font.h:18:10: error: #include expects FILENAME or FILENAME In file included from src/ft2font.cpp:1: src/ft2font.h:31: error: ‘FT_Bitmap’ has not been declared src/ft2font.h:31: error: ‘FT_Int’ has not been declared src/ft2font.h:31: error: ‘FT_Int’ has not been declared src/ft2font.h:77: error: expected ‘,’ or ‘...’ before ‘’ token src/ft2font.h:77: error: ISO C++ forbids declaration of ‘FT_Face’ with no type src/ft2font.h:83: error: expected ‘,’ or ‘...’ before ‘’ token src/ft2font.h:83: error: ISO C++ forbids declaration of ‘FT_Face’ with no type src/ft2font.h:122: error: ‘FT_Face’ does not name a type src/ft2font.h:123: error: ‘FT_Matrix’ does not name a type src/ft2font.h:124: error: ‘FT_Vector’ does not name a type src/ft2font.h:125: error: ‘FT_Error’ does not name a type src/ft2font.h:126: error: ‘FT_Glyph’ was not declared in this scope src/ft2font.h:126: error: template argument 1 is invalid src/ft2font.h:126: error: template argument 2 is invalid src/ft2font.h:127: error: ‘FT_Vector’ was not declared in this scope
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
On Tue, May 25, 2010 at 10:10 AM, George Nurser gnur...@gmail.com wrote: Hi, Installing pkg-config sorted things out for me. http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz Also, you may want to try the make.osx script which lives beside setup.py. See the associated README.osx file. JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
On Tue, May 25, 2010 at 10:45 AM, Pim Schellart p.schell...@gmail.com wrote: Hi John and George, I tried both and although it now seems to find the libraries it still fails to link something. matplotlib-0.99.1.1 $ sudo python setup.py install According to the README I pointed you too, this isn't the command you should be running. Rather, Example usage:: PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_install But I advise you work from the svn trunk if you want to go this route, as I have made some updates for 64bit/python2.6 OSX there svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Compiling matplotlib against 64 bit python 2.6 on OSX Snow Leopard
If what John suggests doesn't work, and you really only need 64 bit, then the nuclear option is to remove all occurrences of -arch i386 from the makefile (assuming you have a framework build) at /Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/config/Makefile This should only generate x86_64. Obviously, save the current one, so you can go back to it. HTH, George. On 25 May 2010 16:58, John Hunter jdh2...@gmail.com wrote: On Tue, May 25, 2010 at 10:45 AM, Pim Schellart p.schell...@gmail.com wrote: Hi John and George, I tried both and although it now seems to find the libraries it still fails to link something. matplotlib-0.99.1.1 $ sudo python setup.py install According to the README I pointed you too, this isn't the command you should be running. Rather, Example usage:: PREFIX=/Users/jdhunter/dev make -f make.osx fetch deps mpl_install But I advise you work from the svn trunk if you want to go this route, as I have made some updates for 64bit/python2.6 OSX there svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib JDH -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users