Matplotlib - python does not find pylab

Nick Guenther kousue at gmail.com
Tue Mar 3 19:17:02 CET 2009


On Tue, Mar 3, 2009 at 12:43 PM, Pau <vim.unix at googlemail.com> wrote:
> Hello,
>
> I said Ihad tried with different versions of python
>
> $ python2.5
> Python 2.5.4 (r254:67916, Feb 26 2009, 18:20:08)
> [GCC 3.3.5 (propolice)] on openbsd4
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import pylab
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/usr/local/lib/python2.5/site-packages/pylab.py", line 1, in <module>
>    from matplotlib.pylab import *
>  File "/usr/local/lib/python2.5/site-packages/matplotlib/__init__.py",
> line 129, in <module>
>    from rcsetup import defaultParams, validate_backend, validate_toolbar
>  File "/usr/local/lib/python2.5/site-packages/matplotlib/rcsetup.py",
> line 19, in <module>
>    from matplotlib.colors import is_color_like
>  File "/usr/local/lib/python2.5/site-packages/matplotlib/colors.py",
> line 54, in <module>
>    import matplotlib.cbook as cbook
>  File "/usr/local/lib/python2.5/site-packages/matplotlib/cbook.py",
> line 17, in <module>
>    preferredencoding = locale.getpreferredencoding()
>  File "/usr/local/lib/python2.5/locale.py", line 514, in getpreferredencoding
>    setlocale(LC_CTYPE, "")
>  File "/usr/local/lib/python2.5/locale.py", line 478, in setlocale
>    return _setlocale(category, locale)
> locale.Error: unsupported locale setting
>
> This is the output when using ksh with the default config file

That's not an ImportError. That's a locale.Error. You can see in the
backtrace from matplotlib.pylab import *, and since it doesn't break
there then presumably you have pylab installed. It says the problem:
"unsupported locale setting". I'm no expert on locales, though.

It is possible that this is a -CURRENT problem. The packages get
rebuilt automatically and not tested. You should report this to the
maintainer of py-matplotlib who is listed here:

$ make search key=py-matplotlib
Port:   py-matplotlib-0.83.2p5
Path:   graphics/py-matplotlib
Info:   Python charting and plotting API
Maint:  Damien Miller <djm at openbsd.org>
Index:  graphics devel
L-deps: iconv.>=4::converters/libiconv
intl.>=3:gettext->=0.10.38:devel/gettext png.>=3::graphics/png
B-deps: :devel/py-dateutil :devel/py-tz :math/py-Numeric :x11/py-gtk2
gettext->=0.10.38:devel/gettext gettext->=0.14.6:devel/gettext
python-2.4*:lang/python/2.4
R-deps: :devel/py-dateutil :devel/py-tz :math/py-Numeric :x11/py-gtk2
gettext->=0.10.38:devel/gettext python-2.4*:lang/python/2.4
Archs:  any



> And also:
>
>>>> import sys
>>>> print sys.path
> ['', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5',
> '/usr/local/lib/python2.5/plat-openbsd4',
> '/usr/local/lib/python2.5/lib-tk',
> '/usr/local/lib/python2.5/lib-dynload',
> '/usr/local/lib/python2.5/site-packages',
> '/usr/local/lib/python2.5/site-packages/Numeric',
> '/usr/local/lib/python2.5/site-packages/gst-0.10',
> '/usr/local/lib/python2.5/site-packages/gtk-2.0']
>
> Do you see something? I don't...

This list of directories is like your shell $PATH. It doesn't matter
what the dirs themselves are, it matters what the contents of those
dirs are. But, above you've shown that indeed python2.5 can access
pylab so you needn't worry about digging around here.

> thanks for the help

Welcome :)

-Nick


More information about the Openbsd-newbies mailing list