ANN: matplotlib 1.3.1

Piet van Oostrum piet at vanoostrum.org
Sat Oct 19 11:18:35 EDT 2013


Ned Deily <nad at acm.org> writes:

> In article <m2zjq6mugp.fsf at cochabamba.vanoostrum.org>,
>  Piet van Oostrum <piet at vanoostrum.org> wrote:
>> I tried to install it from source, on Mac OS X 10.6.8, with Python
>> 3.3.2, and Tck/Tk 8.5 installed as Frameworks, but I get an error during
>> compilation. It seems it doesn't find the Tcl/TK framework.
>> 
>> 
>> building 'matplotlib.backends._tkagg' extension
>> gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot 
>> /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot 
>> /Developer/SDKs/MacOSX10.6.sdk -I/opt/local/include 
>> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__tkagg_ARRAY_API 
>> -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 
>> -I/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-package
>> s/numpy/core/include -I/usr/local/include -I/usr/include -I/usr/X11/include 
>> -I/opt/local/include -I. -I/Library/Frameworks/Tcl.framework/Headers 
>> -I/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders 
>> -I/Library/Frameworks/Tk.framework/Headers 
>> -I/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders 
>> -Iagg24/include 
>> -I/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c 
>> src/ag
>>  g_py_transforms.cpp -o 
>>  build/temp.macosx-10.6-intel-3.3/src/agg_py_transforms.o -framework Tcl 
>>  -framework Tk
>> In file included from 
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/ndarraytypes.h:1760,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/arrayobject.h:4,
>>                  from src/agg_py_transforms.cpp:6:
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning 
>> "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API 
>> NPY_1_7_API_VERSION"
>> i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because 
>> linking not done
>> i686-apple-darwin10-gcc-4.2.1: Tcl: linker input file unused because linking 
>> not done
>> i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because 
>> linking not done
>> i686-apple-darwin10-gcc-4.2.1: Tk: linker input file unused because linking 
>> not done
>> In file included from 
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/ndarraytypes.h:1760,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/arrayobject.h:4,
>>                  from src/agg_py_transforms.cpp:6:
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning 
>> "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API 
>> NPY_1_7_API_VERSION"
>> i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because 
>> linking not done
>> i686-apple-darwin10-gcc-4.2.1: Tcl: linker input file unused because linking 
>> not done
>> i686-apple-darwin10-gcc-4.2.1: -framework: linker input file unused because 
>> linking not done
>> i686-apple-darwin10-gcc-4.2.1: Tk: linker input file unused because linking 
>> not done
>> gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -isysroot 
>> /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -isysroot 
>> /Developer/SDKs/MacOSX10.6.sdk -I/opt/local/include 
>> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__tkagg_ARRAY_API 
>> -DPYCXX_ISO_CPP_LIB=1 -DPYCXX_PYTHON_2TO3=1 
>> -I/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-package
>> s/numpy/core/include -I/usr/local/include -I/usr/include -I/usr/X11/include 
>> -I/opt/local/include -I. -I/Library/Frameworks/Tcl.framework/Headers 
>> -I/Library/Frameworks/Tcl.framework/Versions/Current/PrivateHeaders 
>> -I/Library/Frameworks/Tk.framework/Headers 
>> -I/Library/Frameworks/Tk.framework/Versions/Current/PrivateHeaders 
>> -Iagg24/include 
>> -I/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c 
>> src/_t
>>  kagg.cpp -o build/temp.macosx-10.6-intel-3.3/src/_tkagg.o -framework Tcl 
>>  -framework Tk
>> In file included from 
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/ndarraytypes.h:1760,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/arrayobject.h:4,
>>                  from src/agg_py_path_iterator.h:7,
>>                  from src/_backend_agg.h:43,
>>                  from src/_tkagg.cpp:20:
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning 
>> "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API 
>> NPY_1_7_API_VERSION"
>> In file included from src/_tkagg.cpp:30:
>> /usr/include/tk.h:23:3: error: #error Tk 8.5 must be compiled with tcl.h from 
>> Tcl 8.5
>> In file included from 
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/ndarraytypes.h:1760,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
>>                  from 
>>                  /Library/Frameworks/Python.framework/Versions/3.3/lib/python3
>>                  .3/site-packages/numpy/core/include/numpy/arrayobject.h:4,
>>                  from src/agg_py_path_iterator.h:7,
>>                  from src/_backend_agg.h:43,
>>                  from src/_tkagg.cpp:20:
>> /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/
>> numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning 
>> "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API 
>> NPY_1_7_API_VERSION"
>> In file included from src/_tkagg.cpp:30:
>> /usr/include/tk.h:23:3: error: #error Tk 8.5 must be compiled with tcl.h from 
>> Tcl 8.5
>
> This is a bit of a long shot since I have no personal experience with building 
> matplotlib but it may be an SDK symlink issue.  IIRC, Xcode 3.2.6, the last 
> Xcode 3 release, creates a faulty directory / symlink structure within the 
> 10.6 SDK.  What you need to have is: 
> /Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks containing symlinks to 
> /Library/Frameworks/Tcl.framework and /Library/Frameworks/Tk.framework because 
> of the -isysroot /Developer/SDKs/MacOSX10.6.sdk on the compiler calls.  Also, 
> current versions of Xcode 4 and 5 don't attempt to create a symlink at all so 
> you have to do it manually.  3.2.6 does attempt to do so but gets it wrong.

Thanks for your suggestion. I needed to do this, but it solved a different problem.

The compilation problem above appears to be caused by settings of CPPFLAGS and/or LDFLAGS that pointed to my macports installation. Unsetting these before compilation solved the compiler error.

However, the links you mentioned were also necessary. Without them matplotlib links against the system Tcl/TK in /System/Library, whereas Python's tkinter is linked to the one in /Library. This gives a clash at runtime:

"Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined."

and a couple more of these. Thereafter it crashes. The links in /Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks to the frameworks in /Library make the thing consistent.
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the Python-list mailing list