exporting PYTHONPATH causes matplotlib not to load

Dear all,
I’m running matplotlib 0.98.5.2 on a machine with Ubuntu Intrepid 8.10. It’s worked well for me so far, but I encounter problems running matplotlib when trying to update the PYTHONPATH in the .bashrc file. Adding just the line “export PYTHONPATH=$PYTHONPATH”, for example, gives the following:

$ ipython -pylab
Traceback (most recent call last):
File “/usr/bin/ipython”, line 27, in
IPython.Shell.start().mainloop()
File “/var/lib/python-support/python2.5/IPython/Shell.py”, line 1219, in start
shell = _select_shell(sys.argv)
File “/var/lib/python-support/python2.5/IPython/Shell.py”, line 1188, in _select_shell
backend = matplotlib.rcParams[‘backend’]
AttributeError: ‘module’ object has no attribute ‘rcParams’

On the other hand,

$ ipython

permits ipython to load seemingly normally, but in that case

In [1]: import matplotlib.pyplot as plt
ImportError: No module named pyplot

Any ideas on what might be wrong? I’d be grateful for any advice.

Thanks,
Hani Nakhoul

Dear all,
I'm running matplotlib 0.98.5.2 on a machine with Ubuntu Intrepid 8.10. It's
worked well for me so far, but I encounter problems running matplotlib when
trying to update the PYTHONPATH in the .bashrc file. Adding just the line
"export PYTHONPATH=$PYTHONPATH", for example, gives the following:

$ ipython -pylab
Traceback (most recent call last):
  File "/usr/bin/ipython", line 27, in <module>
    IPython.Shell.start().mainloop()
  File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1219, in
start
    shell = _select_shell(sys.argv)
  File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1188, in
_select_shell
    backend = matplotlib.rcParams['backend']
AttributeError: 'module' object has no attribute 'rcParams'

Most likely you are adding a directory to the path that has a
directory named matplotlib in it (eg the matplotlib src directory)
which is not the matplotlib install directory. Try doing

import matplotlib
print matplotlib.__file__

when the PYTHONPATH is set to the troublesome value and then do an ls
on the directory that is reported by the __file__ printout. Post the
listing here and we can advise further.

JDH

···

On Tue, Jun 9, 2009 at 10:22 AM, Hani Nakhoul<nakhoul@...287...> wrote:

Dear all,
Here is the listing:

In [1]: import matplotlib

In [2]: print matplotlib.file
matplotlib/init.pyc

In [3]: ls -a
./ .gimp-2.6/ Public/
…/ .gksu.lock .pulse/

.adobe/ .gnome2/ .pulse-cookie
ATLAS/ .gnome2_private/ pydstool/
.bash_history .gnupg/ PyDSTool/
.bash_logout .gstreamer-0.10/ .recently-used
.bashrc .gtk-bookmarks .recently-used.xbel

.bashrc~ .gvfs/ scipy-0.7.0b1/
.cache/ .hplip/ scipy_build/
.checkgmail/ .ICEauthority .ssh/
.compiz/ .icons/ .subversion/
.config/ .inkscape/ .sudo_as_admin_successful

.dbus/ .ipython/ SuiteSparse/
Desktop/ lapack-3.1.1/ Templates/
.dmrc .lftp/ .themes/
Documents/ .local/ .thumbnails/
.emacs .macromedia/ .tomboy/

.emacs.d/ matplotlib/ .tomboy.log
.esd_auth .matplotlib/ .tsclient/
.evolution/ .mozilla/ .update-manager-core/
Examples@ .mozilla-thunderbird/ .update-notifier/
fftw-3.2/ Music/ Videos/
.fontconfig/ .nautilus/ .viminfo
.gconf/ neuron/ .wapi/
.gconfd/ numpy-1.2.1/ .Xauthority
.geany/ .openoffice.org2/ .xsession-errors
.gegl-0.0/ Pictures/

.gftp/ .profile

Hani

···

On Tue, Jun 9, 2009 at 10:30 AM, John Hunter <jdh2358@…287…> wrote:

On Tue, Jun 9, 2009 at 10:22 AM, Hani Nakhoul<nakhoul@…287…> wrote:

Dear all,

I’m running matplotlib 0.98.5.2 on a machine with Ubuntu Intrepid 8.10. It’s

worked well for me so far, but I encounter problems running matplotlib when

trying to update the PYTHONPATH in the .bashrc file. Adding just the line

“export PYTHONPATH=$PYTHONPATH”, for example, gives the following:

$ ipython -pylab

Traceback (most recent call last):

File “/usr/bin/ipython”, line 27, in

IPython.Shell.start().mainloop()

File “/var/lib/python-support/python2.5/IPython/Shell.py”, line 1219, in

start

shell = _select_shell(sys.argv)

File “/var/lib/python-support/python2.5/IPython/Shell.py”, line 1188, in

_select_shell

backend = matplotlib.rcParams['backend']

AttributeError: ‘module’ object has no attribute ‘rcParams’

Most likely you are adding a directory to the path that has a

directory named matplotlib in it (eg the matplotlib src directory)

which is not the matplotlib install directory. Try doing

import matplotlib

print matplotlib.file

when the PYTHONPATH is set to the troublesome value and then do an ls

on the directory that is reported by the file printout. Post the

listing here and we can advise further.

JDH

Dear all,
Here is the listing:

In [1]: import matplotlib

In [2]: print matplotlib.__file__
matplotlib/__init__.pyc

In [3]: ls -a
./ .gimp-2.6/ Public/
../ .gksu.lock .pulse/
.adobe/ .gnome2/ .pulse-cookie
ATLAS/ .gnome2_private/ pydstool/
.bash_history .gnupg/ PyDSTool/
.bash_logout .gstreamer-0.10/ .recently-used
.bashrc .gtk-bookmarks .recently-used.xbel
.bashrc~ .gvfs/ scipy-0.7.0b1/
.cache/ .hplip/ scipy_build/
.checkgmail/ .ICEauthority .ssh/
.compiz/ .icons/ .subversion/
.config/ .inkscape/ .sudo_as_admin_successful
.dbus/ .ipython/ SuiteSparse/
Desktop/ lapack-3.1.1/ Templates/
.dmrc .lftp/ .themes/
Documents/ .local/ .thumbnails/
.emacs .macromedia/ .tomboy/
.emacs.d/ matplotlib/ .tomboy.log
.esd_auth .matplotlib/ .tsclient/
.evolution/ .mozilla/ .update-manager-core/
Examples@ .mozilla-thunderbird/ .update-notifier/
fftw-3.2/ Music/ Videos/
.fontconfig/ .nautilus/ .viminfo
.gconf/ neuron/ .wapi/
.gconfd/ numpy-1.2.1/ .Xauthority
.geany/ .openoffice.org2/ .xsession-errors
.gegl-0.0/ Pictures/
.gftp/ .profile

What I wanted was the listing of the "matplotlib" dir

ls matplotlib

it looks like you have a matplotlib dir in your working directory that
is being picked up and you probably don't want it.

JDH

···

On Tue, Jun 9, 2009 at 2:13 PM, Hani Nakhoul<nakhoul@...287...> wrote:

I’m sorry–here’s the right listing:

$ ls matplotlib
agg24 examples KNOWN_BUGS PKG-INFO setup.py
build init.py lib README.txt src
build.out init.pyc license setup.cfg.template TODO
CHANGELOG INSTALL Makefile setupegg.py ttconv
CXX install.out MANIFEST.in setupext.py
doc INTERACTIVE matplotlibrc.template setupext.pyc

Hani

···

On Tue, Jun 9, 2009 at 2:34 PM, John Hunter <jdh2358@…287…> wrote:

On Tue, Jun 9, 2009 at 2:13 PM, Hani Nakhoul<nakhoul@…287…> wrote:

Dear all,

Here is the listing:

In [1]: import matplotlib

In [2]: print matplotlib.file

matplotlib/init.pyc

In [3]: ls -a

./ .gimp-2.6/ Public/

…/ .gksu.lock .pulse/

.adobe/ .gnome2/ .pulse-cookie

ATLAS/ .gnome2_private/ pydstool/

.bash_history .gnupg/ PyDSTool/

.bash_logout .gstreamer-0.10/ .recently-used

.bashrc .gtk-bookmarks .recently-used.xbel

.bashrc~ .gvfs/ scipy-0.7.0b1/

.cache/ .hplip/ scipy_build/

.checkgmail/ .ICEauthority .ssh/

.compiz/ .icons/ .subversion/

.config/ .inkscape/ .sudo_as_admin_successful

.dbus/ .ipython/ SuiteSparse/

Desktop/ lapack-3.1.1/ Templates/

.dmrc .lftp/ .themes/

Documents/ .local/ .thumbnails/

.emacs .macromedia/ .tomboy/

.emacs.d/ matplotlib/ .tomboy.log

.esd_auth .matplotlib/ .tsclient/

.evolution/ .mozilla/ .update-manager-core/

Examples@ .mozilla-thunderbird/ .update-notifier/

fftw-3.2/ Music/ Videos/

.fontconfig/ .nautilus/ .viminfo

.gconf/ neuron/ .wapi/

.gconfd/ numpy-1.2.1/ .Xauthority

.geany/ .openoffice.org2/ .xsession-errors

.gegl-0.0/ Pictures/

.gftp/ .profile

What I wanted was the listing of the “matplotlib” dir

ls matplotlib

it looks like you have a matplotlib dir in your working directory that

is being picked up and you probably don’t want it.

JDH

I'm sorry--here's the right listing:

$ ls matplotlib
agg24 examples KNOWN_BUGS PKG-INFO setup.py
build __init__.py lib README.txt src
build.out __init__.pyc license setup.cfg.template TODO
CHANGELOG INSTALL Makefile setupegg.py ttconv
CXX install.out MANIFEST.in setupext.py
doc INTERACTIVE matplotlibrc.template setupext.pyc

es, this is your problem. You have the matplotlib source directory in
your HOME directory and when you run from your home directory, it is
being picked up instead of the installation directory. I usually name
my src tree "mpl" to avoid this problem

  > cd
  > mv matplotlib mpl

JDH

···

On Tue, Jun 9, 2009 at 2:42 PM, Hani Nakhoul<nakhoul@...287...> wrote: