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?

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.

But why does everything work fine, when I start an Enthought ipython withOUT the -pylab switch?
Importing 'from osgeo import gdal' and using it works fine in this case (Tried ReadAsArray from a gdal dataset and imshow'ed it without problems, apart from that I had to call show() because of the lack of the -pylab switch, but other than that, fine).

PS.: Sorry for the mail-list noob question, but how can I nicely reply to your answer like you replied to my question, with 'Robert Kern wrote' and so on? There's no reply possible on sourceforge and the digest contains obviously many emails, so how do you do this? :wink:

···

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

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.

But why does everything work fine, when I start an Enthought ipython withOUT the -pylab switch?
Importing 'from osgeo import gdal' and using it works fine in this case (Tried ReadAsArray from a gdal dataset and imshow'ed it without problems, apart from that I had to call show() because of the lack of the -pylab switch, but other than that, fine).

Hmm, don't know. Getting a gdb traceback for the bus error would help identify the problem.

PS.: Sorry for the mail-list noob question, but how can I nicely reply to your answer like you replied to my question, with 'Robert Kern wrote' and so on? There's no reply possible on sourceforge and the digest contains obviously many emails, so how do you do this? :wink:

I use an NNTP newsreader to read this list via GMane, but you can just change your subscription to not use the digest. Scroll down to the bottom of this page to log in and edit your delivery options:

You will get every message in your inbox individually. You should do this if you are going to be replying to messages. Please consider the digest as read-only.

···

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

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