importing pylab??

Hi,

I installed scipy a few days ago on my laptop (with os linux
debian), but while importing the pylab module from the python-matplotlib (version 0.98.1-1) I got the following error:

···

Python 2.5.2 (r252:60911, Aug 8 2008, 09:22:44)
[GCC 4.3.1] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import scipy

import numpy

import pylab
Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python2.5/site-packages/pylab.py”, line 1, in

from matplotlib.pylab import *

File “/usr/lib/python2.5/site-packages/matplotlib/init.py”, line 128, in
from rcsetup import defaultParams, validate_backend, validate_toolbar

File “/usr/lib/python2.5/site-packages/matplotlib/rcsetup.py”, line 18, in
from matplotlib.colors import is_color_like
File “/usr/lib/python2.5/site-packages/matplotlib/colors.py”, line 39, in

import matplotlib.cbook as cbook

File “/usr/lib/python2.5/site-packages/matplotlib/cbook.py”, line 14, in
preferredencoding = locale.getpreferredencoding()
File “/usr/lib/python2.5/locale.py”, line 514, in getpreferredencoding

setlocale(LC_CTYPE, "")

File “/usr/lib/python2.5/locale.py”, line 478, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

Could you please help me ?

Best regards,
Saber

It seems you have your locale set to something that Python doesn't support.

Can you send the output of "locale" to this list?

For example, I have:

> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Saber Mbarek wrote:

···

Hi,

I installed scipy a few days ago on my laptop (with os linux debian), but while importing the pylab module from the python-matplotlib (version 0.98.1-1) I got the following error:

-------------------------------------------------------------------------------------------------------------
Python 2.5.2 (r252:60911, Aug 8 2008, 09:22:44)
[GCC 4.3.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> import numpy
>>> import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/usr/lib/python2.5/site-packages/matplotlib/__init__.py", line 128, in <module>
    from rcsetup import defaultParams, validate_backend, validate_toolbar
  File "/usr/lib/python2.5/site-packages/matplotlib/rcsetup.py", line 18, in <module>
    from matplotlib.colors import is_color_like
  File "/usr/lib/python2.5/site-packages/matplotlib/colors.py", line 39, in <module>
    import matplotlib.cbook as cbook
  File "/usr/lib/python2.5/site-packages/matplotlib/cbook.py", line 14, in <module>
    preferredencoding = locale.getpreferredencoding()
  File "/usr/lib/python2.5/locale.py", line 514, in getpreferredencoding
    setlocale(LC_CTYPE, "")
  File "/usr/lib/python2.5/locale.py", line 478, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
------------------------------------------------------------------------------------------------------------

Could you please help me ?

Best regards,
Saber

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

hier is the output of locale:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

LANG=de_DE@…2174…
LANGUAGE=de_DE:de:en_GB:en
LC_CTYPE=“de_DE@…2174…”
LC_NUMERIC=“de_DE@…2174…”
LC_TIME=“de_DE@…2174…”
LC_COLLATE=“de_DE@…2174…”
LC_MONETARY=“de_DE@…2174…”

LC_MESSAGES=“de_DE@…2174…”
LC_PAPER=“de_DE@…2174…”
LC_NAME=“de_DE@…2174…”
LC_ADDRESS=“de_DE@…2174…”
LC_TELEPHONE=“de_DE@…2174…”
LC_MEASUREMENT=“de_DE@…2174…”

LC_IDENTIFICATION=“de_DE@…2174…”
LC_ALL=

Saber

de_DE@...2174... is perfectly valid and works fine with Python 2.5.2 on my machine, so it would appear it's not a Python shortcoming.

I suspect this is related to these lines:

Saber Mbarek wrote:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

This (usually) indicates that the definitions for the locale you've specified are not installed.

If you do

"locale -a"

is de_DE@...2174... listed?

If not, it's possible you're missing a package. But this is looking like a system configuration error, not a matplotlib one.

You may also get some clues from this Python bug:

http://bugs.python.org/issue1443504

Hope that at least helps. Sorry I can't suggest anything else -- I've never actually seen this myself, but then I work in a little English-speaking, U.S.-centric ignorance bubble :wink:

Mike

···

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

locale -a

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory

C
POSIX

Yes I think there is missing package, so i will look for that …

Mike, thank you for your help and make a good work in your bubble :wink:

Saber