Matplotlib - python does not find pylab

Pau vim.unix at googlemail.com
Tue Mar 3 20:50:46 CET 2009


> That makes sense. That's because `python` is python2.4 for you, as
> shown in the first test you ran for me. When you pkg_add python it
> tells you

yes, I know, but I was puzzled because I could swear I had tried
python2.5 and I had had the same problem...

> May I suggest that you run those commands?

absolutely... but I had already done it

Again charmed by the politeness and helpfulness of this mailing list, yours,

Pau

>
> On Tue, Mar 3, 2009 at 1:45 PM, Pau <vim.unix at googlemail.com> wrote:
>> PS: Using
>>
>> #!/usr/bin/env python
>>
>> leads to the same problem, even using export LANG=C (this is Python 2.4.6)
>>
>> Using
>>
>> #!/usr/bin/env python2.5
>>
>> solves it
>>
>> 2009/3/3 Pau <vim.unix at googlemail.com>:
>>> thanks, Nick
>>>
>>> I have fixed the problem.
>>>
>>> I was also thinking that it could be due to this locale thing but,
>>> since I started ksh with the default kshrc, I assumed that it'd be
>>> export LANG=C per default, but it isn't?? I should not assume
>>> anything...
>>>
>>> Look at this:
>>>
>>> hux(p2)| ksh
>>> $ export LANG=C
>>> $ date   -----------------------------------> This is to check that
>>> the LANG is C
>>> Tue Mar  3 19:36:02 CET 2009 --> it is
>>> $ ./Pfewbody.py
>>>
>>> Guess ... it's working now
>>>
>>> When I export LANG=C in zsh, it's working too
>>>
>>> I am a bit puzzled. I could swear I had tried this too...
>>>
>>> Anyway...
>>>
>>> Thanks again.
>>>
>>> Pau
>>>
>>> 2009/3/3 Nick Guenther <kousue at gmail.com>:
>>>> 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
>>>>
>>>
>>>
>>>
>>> --
>>> Let there be peace on earth. And let it begin with misc
>>>
>>
>>
>>
>> --
>> Let there be peace on earth. And let it begin with misc
>>
>



-- 
Let there be peace on earth. And let it begin with misc


More information about the Openbsd-newbies mailing list