matplotlib, ipython and ubuntu

Hello!

Hmm, I did reinstall and still no joy, it insists on install python2.4 at the same time!

do a
$: sudo apt-get --purge remove matplotlib ipython
to really remove the configuration files. then
$: sudo apt-get install matplotlib ipython
check if pylab is on your system:
$: locate pylab

Here are the contents of pylab:
from matplotlib.pylab import *

so you may just test this in a python shell:

$ python
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib.pylab import *
>>>

then do the same from within ipython as I'd shown in my previous mail.

I hope that this helps you to narrow it down.

I have also some troubles with ipython that is currently in Gutsy:
  ipython
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.1 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import timeseries as TS

In [2]: whos

···

---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)

/var/tmp/install/qgislite_trunk/<ipython console> in <module>()

/var/lib/python-support/python2.5/IPython/iplib.py in ipmagic(self, arg_s)
     962 else:
     963 magic_args = self.var_expand(magic_args,1)
--> 964 return fn(magic_args)
     965
     966 def ipalias(self,arg_s):

/var/lib/python-support/python2.5/IPython/Magic.py in magic_whos(self, parameter_s)
     989 array_type = None
     990 else:
--> 991 array_type = Numeric.ArrayType.__name__
     992
     993 # Find all variable names and types so we can figure out column sizes

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'ArrayType'

maybe some of the IPython power users can give me a hint why this happes. [1]
I have already filed a bug report to Ubuntu but are not able to explain more:
magic function whos not working in ipython
https://bugs.launchpad.net/ubuntu/+source/ipython/+bug/177253

Kind regards,
Timmie

[1] Thats Why I crosspost to ipython-user. Inital post was: http://permalink.gmane.org/gmane.comp.python.matplotlib.general/11463

Very strange. I can't reproduce it here (on gutsy, but running
ipython from my own tree). What's odd is this:

In [1]: import Numeric

In [2]: print Numeric.ArrayType
<type 'array'>

So Numeric *most definitely* has an ArrayType member. Try doing the
same as I did, also showing us whether you started ipython with -pylab
or not. There may be something odd about your Numeric installation.
Also do this:

In [3]: Numeric?
Type: module
Base Class: <type 'module'>
Namespace: Interactive
File: /usr/lib/python2.5/site-packages/Numeric/Numeric.py

[etc]

It's possible that you have in your path a file called Numeric.py
which is not the 'real' Numeric module. This would explain your
problem and why nobody else sees it.

Cheers,

f

···

On Jan 29, 2008 4:13 PM, Tim Michelsen <timmichelsen@...1423...> wrote:

In [1]: import timeseries as TS

In [2]: whos
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)

/var/tmp/install/qgislite_trunk/<ipython console> in <module>()

/var/lib/python-support/python2.5/IPython/iplib.py in ipmagic(self, arg_s)
     962 else:
     963 magic_args = self.var_expand(magic_args,1)
--> 964 return fn(magic_args)
     965
     966 def ipalias(self,arg_s):

/var/lib/python-support/python2.5/IPython/Magic.py in magic_whos(self,
parameter_s)
     989 array_type = None
     990 else:
--> 991 array_type = Numeric.ArrayType.__name__
     992
     993 # Find all variable names and types so we can figure
out column sizes

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'ArrayType'

maybe some of the IPython power users can give me a hint why this
happes. [1]

Hello Fernando,

<type 'exceptions.AttributeError'>: 'module' object has no attribute
'ArrayType'

maybe some of the IPython power users can give me a hint why this
happes. [1]

Very strange. I can't reproduce it here (on gutsy, but running
ipython from my own tree). What's odd is this:

In [1]: import Numeric

In [2]: print Numeric.ArrayType
<type 'array'>

So Numeric *most definitely* has an ArrayType member. Try doing the
same as I did, also showing us whether you started ipython with -pylab
or not. There may be something odd about your Numeric installation.
Also do this:

In [3]: Numeric?
Type: module
Base Class: <type 'module'>
Namespace: Interactive
File: /usr/lib/python2.5/site-packages/Numeric/Numeric.py

[etc]

It's possible that you have in your path a file called Numeric.py
which is not the 'real' Numeric module. This would explain your
problem and why nobody else sees it.

Cheers,

f

*** my output ***
$ ipython
Python 2.5.1 (r251:54863, Oct 5 2007, 13:36:32)
Type "copyright", "credits" or "license" for more information.

IPython 0.8.1 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import Numeric

In [2]: print Numeric.ArrayType

···

---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)

/home/timmie/<ipython console> in <module>()

<type 'exceptions.AttributeError'>: 'module' object has no attribute 'ArrayType'

In [3]: Numeric?
Type: module
Base Class: <type 'module'>
String Form: <module 'Numeric' from '/home/timmie/development/python/modules/modules_library/Numeric/__init__.pyc'>
Namespace: Interactive
File: /home/timmie/development/python/modules/modules_library/Numeric/__init__.py
Docstring:
     <no docstring>

In [4]:

*** end code ***

=> You were absolutely right:
I had another Numeric package install in my PYTHONPATH. It overwrode the system package at:
/usr/lib/python2.5/site-packages/Numeric/Numeric.py

I just deleted /home/timmie/development/python/modules/modules_library/Numeric and now everything to goes nice. I can use my Ipython again with numerics :wink:
Well, I guess the problem arose from the a time when I didn't have network access.
I just threw python modules from the net into my PYTHONPATH without using the Synaptic package manager.

Nice that this is now solved. Thanks for your quick answer and help!

Kind regards,
Timmie