ipython pylab switch, GDAL, Enthought

Dear all,

maybe this should go to the Enthought list, but as the failure is directly related to the pylab switch of ipython, I thought I try it here first:

On OSX I have trouble with using the pylab switch for ipython after I copied the gdal.pth into the Enthought site-packages folder (to be able to use my KyngChaos GDAL Frameworks inside the Enthought Python).

The gdal.pth does the following to the sys.path:
import sys; sys.path.insert(0,'/Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages')

and in that folder there is:

-rw-rw-r-- 1 root admin 128B 8 Feb 20:52 gdal.py
-rw-r--r-- 1 root admin 274B 3 Mar 23:20 gdal.pyc
-rw-rw-r-- 1 root admin 143B 8 Feb 20:52 gdalconst.py
-rw-r--r-- 1 root admin 304B 3 Mar 23:20 gdalconst.pyc
-rw-rw-r-- 1 root admin 147B 8 Feb 20:52 gdalnumeric.py
-rw-r--r-- 1 root admin 309B 3 Mar 23:20 gdalnumeric.pyc
drwxrwxr-x 42 root admin 1.4K 3 Mar 23:20 numpy
-rw-rw-r-- 1 root admin 125B 8 Feb 20:52 ogr.py
-rw-r--r-- 1 root admin 286B 3 Mar 23:20 ogr.pyc
drwxrwxr-x 21 root admin 714B 3 Mar 23:20 osgeo
-rw-rw-r-- 1 root admin 125B 8 Feb 20:52 osr.py
-rw-r--r-- 1 root admin 286B 3 Mar 23:20 osr.pyc

Maybe the double import of a potentially different numpy compared to the Enthought numpy creates the Bus Error?
If so, how can I avoid it?

For a complete picture, here is my sys.path:

['',
'/Library/Frameworks/Python.framework/Versions/6.1/bin',
'/Users/aye/Library/Python/2.6/site-packages/ipython-0.10-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/pydot-1.0.2-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/pyparsing-1.5.2-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/simplejson-2.0.9-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/python_twitter-0.6-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/PIL-1.1.7-py2.6-macosx-10.6-universal.egg',
'/Users/aye/Library/Python/2.6/site-packages/Sphinx-0.6.3-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/docutils-0.6-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/Jinja2-2.2.1-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/Pygments-1.1.1-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/spyder-1.0.3-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/scikits.image-0.2.2-py2.6-macosx-10.5-i386.egg',
'/Users/aye/Library/Python/2.6/site-packages/PyXML-0.8.4-py2.6-macosx-10.6-universal.egg',
'/Users/aye/Library/Python/2.6/site-packages/pyfo-0.6-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/Amara-2.0a4-py2.6-macosx-10.6-universal.egg',
'/Users/aye/Library/Python/2.6/site-packages/setuptools-0.6c11-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/distribute-0.6.10-py2.6.egg',
'/Users/aye/Library/Python/2.6/site-packages/pip-0.6.3-py2.6.egg',
'/Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python26.zip',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/plat-mac',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/plat-mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/lib-tk',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/lib-old',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/PIL',
'/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info',
'/Users/aye/Library/Python/2.6/site-packages',
'/Users/aye/Library/Python/2.6/site-packages/PIL',
'/Users/aye/Library/Python/2.6/site-packages/ipython-0.10-py2.6.egg/IPython/Extensions',
u'/Users/aye/.ipython']

I am grateful for any hint how to make the -pylab switch working again in this scenario.

Best regards,
Michael

Dear all,

maybe this should go to the Enthought list, but as the failure is directly related to the pylab switch of ipython, I thought I try it here first:

On OSX I have trouble with using the pylab switch for ipython after I copied the gdal.pth into the Enthought site-packages folder (to be able to use my KyngChaos GDAL Frameworks inside the Enthought Python).

The gdal.pth does the following to the sys.path:
import sys; sys.path.insert(0,'/Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages')

and in that folder there is:

-rw-rw-r-- 1 root admin 128B 8 Feb 20:52 gdal.py
-rw-r--r-- 1 root admin 274B 3 Mar 23:20 gdal.pyc
-rw-rw-r-- 1 root admin 143B 8 Feb 20:52 gdalconst.py
-rw-r--r-- 1 root admin 304B 3 Mar 23:20 gdalconst.pyc
-rw-rw-r-- 1 root admin 147B 8 Feb 20:52 gdalnumeric.py
-rw-r--r-- 1 root admin 309B 3 Mar 23:20 gdalnumeric.pyc
drwxrwxr-x 42 root admin 1.4K 3 Mar 23:20 numpy
-rw-rw-r-- 1 root admin 125B 8 Feb 20:52 ogr.py
-rw-r--r-- 1 root admin 286B 3 Mar 23:20 ogr.pyc
drwxrwxr-x 21 root admin 714B 3 Mar 23:20 osgeo
-rw-rw-r-- 1 root admin 125B 8 Feb 20:52 osr.py
-rw-r--r-- 1 root admin 286B 3 Mar 23:20 osr.pyc

Maybe the double import of a potentially different numpy compared to the Enthought numpy creates the Bus Error?

Not so much a double import. Only one version ever gets imported, but the GDAL Python bindings expect its version and matplotlib expects another version.

If so, how can I avoid it?

You would have to rebuild the GDAL Python bindings against Enthought's numpy.

···

On 2010-04-13 10:18 AM, K. -Michael Aye wrote:

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco