NameError: global name '__loader__' is not defined

Thanks to Eric Firing and Christopher Barker for input on trying to
resolve the problem. Christopher said:
%%%
You might try just:

easy_install numpy

easy_install matplotlib.
%%%

I did that and now the problem moved and I get:

···

===

from pylab import *

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/pylab.py", line 222, in ?
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/__init__.py", line 24, in pylab_setup
    globals(),locals(),[backend_name])
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gtkagg.py", line 10, in ?
    from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
    FigureCanvasGTK,\
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gtk.py", line 21, in ?
    from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gdk.py", line 35, in ?
    from matplotlib.backends._ns_backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _ns_backend_gdk

Googling around has indicated that the X11 stuff wasn't available when the
numpy and matplotlib were made. The gtk files and "-devel" seem to be there
when I do an "rpm -qa". I went and got a new numpy from source and did
"python setup.py install". It is interesting that when I get in to python
now, I can do:

import gtk
import numpy
import matplotlib

and they all just return the prompt, indicating, I thought, that the
programs were installed ok.

Here is the naive question -> Is there something wrong, then with a
"from pylab import *"? The user is trying to do that.

Thanks for any assistance that can be given.

Hal

Hal Huntley wrote:

> I'm a sys admin trying to install the matplotlib python package for
> someone on our staff. I'm not overly familar with python.

> We are trying to use matplotlib with pylab.

> uname -a
> Linux andromeda 2.6.13-1.1532_FC4smp #1 SMP Thu Oct 20 01:51:51 EDT 2005
> i686 i686 i386 GNU/Linux

> The python version we have is the default that we got with the Fedora
> Core 4 package.

> python -V
> Python 2.4.1

> I've installed using /usr/bin/easy_install:
> matplotlib-0.90.1-py2.4-win32.egg numpy-1.0.3.1-py2.4-win32.egg

I've never understood eggs and easy_install, but it certainly doesn't
look right that you are installing things labelled "win32" on a Linux
box! I'm surprised you got that far.

For linux, I like to install from source, since the distro packages for
numpy and mpl are usually too old. If you get the tarballs, build and
install numpy first, then mpl. You don't need or want Numeric or
numarray. The build process may fail. If it does, it is because you
need to install distro packages with headers for various libraries, and
you should be able to see from the failures which headers are missing.

Maybe someone else can provide more detailed instructions for Fedora C4.

Eric

>
> If we get in to python and give the command:
>>>> from pylab import *
>
> We get:
> ==
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/pylab.py", line 1, in ?
> from matplotlib.pylab import *
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/pylab.py", line 201, in ?
> import mlab #so I can override hist, psd, etc...
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/mlab.py", line 64, in ?
> import nxutils
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/nxutils.py", line 17, in ?
> from matplotlib._ns_nxutils import *
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/_ns_nxutils.py", line 7, in ?
> __bootstrap__()
> File
> "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-win32.egg/matplotlib/_ns_nxutils.py", line 5, in __bootstrap__
> del __bootstrap__, __loader__
> NameError: global name '__loader__' is not defined
> ==
>
> I've read that numeric may need to be installed, so I got "Numeric-24.2"
> and did:
> python setup.py build
> python setup.py install
>
> That didn't help solve the issue.
>
> Is there some other package that needs to be installed? I checked the FAQ
> and this issue does not seem to be there.
>
> Regards,
>
> Hal Huntley
> SRI International

Hal Huntley wrote:

Thanks to Eric Firing and Christopher Barker for input on trying to
resolve the problem. Christopher said:
%%%
You might try just:

easy_install numpy

easy_install matplotlib.
%%%

I did that and now the problem moved and I get:

from pylab import *

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/pylab.py", line 1, in ?
    from matplotlib.pylab import *
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/pylab.py", line 222, in ?
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/__init__.py", line 24, in pylab_setup
    globals(),locals(),[backend_name])
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gtkagg.py", line 10, in ?
    from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK,
    FigureCanvasGTK,\
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gtk.py", line 21, in ?
    from matplotlib.backends.backend_gdk import RendererGDK, FigureCanvasGDK
  File
  "/usr/lib/python2.4/site-packages/matplotlib-0.90.1-py2.4-linux-i686.egg/matplotlib/backends/backend_gdk.py", line 35, in ?
    from matplotlib.backends._ns_backend_gdk import pixbuf_get_pixels_array
ImportError: No module named _ns_backend_gdkd4

Is it a rotten egg?

Googling around has indicated that the X11 stuff wasn't available when the
numpy and matplotlib were made. The gtk files and "-devel" seem to be there
when I do an "rpm -qa". I went and got a new numpy from source and did
"python setup.py install". It is interesting that when I get in to python
now, I can do:

import gtk
import numpy
import matplotlib

and they all just return the prompt, indicating, I thought, that the
programs were installed ok.

Here is the naive question -> Is there something wrong, then with a
"from pylab import *"? The user is trying to do that.

No, that should work fine. I don't know how the egg-based matplotlib/pylab should work with the installed-from-source numpy, though. If the versions are compatible, then I expect it would work.

You gave a traceback resulting from "from pylab import *" after installing the two eggs, correct? If so, what was the result after you installed numpy from source? I would expect no difference, because the problem reported in the traceback is a missing matplotlib module, not a missing numpy module.

Or did you mean that you installed matplotlib from source? That would make more sense, and certainly should work if all the right header files and libraries are present.

If you installed matplotlib from source, what do you get from
ls /usr/lib/python2.4/site-packages/matplotlib/backends/*.so

Another diagnostic would be to delete the build directory from the matplotlib source tree (assuming you are now building matplotlib from source), and save the output from the "python setup.py build" command. This should make it clear whether the necessary headers really were found.

Eric