[GRASS-dev] grass + matplotlib on mac osx snow leopard

Massimo Di Stefano massimodisasha at gmail.com
Mon Feb 8 13:37:25 EST 2010


Hi William,

don't know if these note can help to know where is the problem :


The matplotlib freetype libs are build with both architecture : 


GRASS 6.5.svn (spearfish60):~ > file /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so: Mach-O universal binary with 2 architectures
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so (for architecture i386):	Mach-O bundle i386
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so (for architecture x86_64):	Mach-O 64-bit bundle x86_64
GRASS 6.5.svn (spearfish60):~ > 


if i try to run matplotlib  "import ft2font" from a  grass shell, it fails if i use the standard python executable (python, python2.6, pythonw) 
while it  ("from matplotlib import ft2font") works  if i run it from "grass->ipython"

###################

from grass
run python :

>>> from matplotlib import ft2font
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
  Referenced from: /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
>>> 


###################

from grass 
run ipython :

GRASS 6.5.svn (spearfish60):~ > ipython
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
Type "copyright", "credits" or "license" for more information.

IPython 0.11.bzr.r1205 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from matplotlib import ft2font

###################

from bash
run python :

Last login: Mon Feb  8 19:13:21 on ttys000
MacBook-Pro-15-di-Massimo-Di-Stefano:~ sasha$ python
Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import ft2font
>>> 

###################

this the grass error tring to use the module, it is the same error i get from grass->python


GRASS 6.5.svn (spearfish60):~ > r.ipso.py Traceback (most recent call last):
  File "/Library/GRASS/6.5/Modules/bin/r.ipso.py", line 27, in <module>
    import matplotlib.pyplot as plt
  File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/pyplot.py", line 7, in <module>
    from matplotlib.figure import Figure, figaspect
  File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/figure.py", line 18, in <module>
    from axes import Axes, SubplotBase, subplot_class_factory
  File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/axes.py", line 12, in <module>
    import matplotlib.axis as maxis
  File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/font_manager.py", line 52, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
  Referenced from: /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
  Expected in: flat namespace
 in /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so




GRASS 6.5.svn (spearfish60):~ > file /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so: Mach-O universal binary with 2 architectures
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so (for architecture i386):	Mach-O bundle i386
/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so (for architecture x86_64):	Mach-O 64-bit bundle x86_64
GRASS 6.5.svn (spearfish60):~ > 


thanks for any suggestions to debug thisproblem.
ciao,

Massimo.



Il giorno 08/feb/2010, alle ore 16.05, William Kyngesburye ha scritto:

> I haven't built matplotlib before, but it looks like it linked FreeType statically into ft2font.so.
> 
> You normally get an error about a missing architecture if that's the problem.  But in the case of a statically linked library, maybe ft2font.so (matplotlib) is the right arch, but the linked freetype was not.  Because of the way Python modules are linked, you don't get link errors so you don't know until you run it.
> 
> Try checking the archs on the freetype used when compiling matplotlib, and check the archs on ft2font.so.  They should have the same archs.
> 
> On Feb 8, 2010, at 5:11 AM, Massimo Di Stefano wrote:
> 
>> Hi All,
>> 
>> I'm working on a script to generate graph from grass using matplotlib
>> the script works fine on linux , but on osx it works only by command line
>> 
>> the script is :
>> 
>> https://svn.osgeo.org/grass/grass-addons/raster/r.ipso
>> 
>> the error tring to run it on osx is :
>> 
>> GRASS 7.0.svn (spearfish60):~ > r.ipso.py 
>> Traceback (most recent call last):
>> File "/Library/Application Support/GRASS/7.0/Modules/bin/r.ipso.py", line 27, in <module>
>>   import matplotlib.pyplot as plt
>> File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/pyplot.py", line 7, in <module>
>>   from matplotlib.figure import Figure, figaspect
>> File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/figure.py", line 18, in <module>
>>   from axes import Axes, SubplotBase, subplot_class_factory
>> File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/axes.py", line 12, in <module>
>>   import matplotlib.axis as maxis
>> File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/axis.py", line 10, in <module>
>>   import matplotlib.font_manager as font_manager
>> File "/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/font_manager.py", line 52, in <module>
>>   from matplotlib import ft2font
>> ImportError: dlopen(/Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so, 2): Symbol not found: _FT_Attach_File
>> Referenced from: /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
>> Expected in: flat namespace
>> in /Library/Python/2.6/site-packages/matplotlib-1.0.svn_r7892-py2.6-macosx-10.6-universal.egg/matplotlib/ft2font.so
>> GRASS 7.0.svn (spearfish60):~ > 
>> 
>> 
>> i have the same error in grass64 and 65 too.
>> have you any hints about ?
>> 
>> maybe matplotlib is build on my osx only in 64 bit mode .. and this generate the problems, how to debug ? 
>> 
>> if (from grass) i start python and try yo import " from matplotlib import ft2font " i have no errors.
>> 
>> thanks for any suggestion.
>> 
>> Massimo._______________________________________________
>> grass-dev mailing list
>> grass-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-dev
> 
> -----
> William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
> http://www.kyngchaos.com/
> 
> [Trillian]  What are you supposed to do WITH a maniacally depressed robot?
> 
> [Marvin]  You think you have problems?  What are you supposed to do if you ARE a maniacally depressed robot?  No, don't try and answer, I'm 50,000 times more intelligent than you and even I don't know the answer...
> 
> - HitchHiker's Guide to the Galaxy
> 
> 



More information about the grass-dev mailing list