problem mit python installation: 'import site' failed

31/08/2009 - 15:26 von Hubert Krause | Report spam
Hallo alle,

seit einem Python Update unter CentOS (Python 2.4) gibt es einen (oder
mehrere) seltsame Fehler. Ich bekomme immer die Meldung:
'import site' failed; use -v for traceback
die scripte funktionieren aber tadelos (yum zum beispiel) bis auf trac, das
die matplotlib nutzt und über einen falschen Pfad fürs homeverzeichnis
stolpert:

PythonHandler trac.web.modpython_frontend:
File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line 439,
in _get_configdir raise RuntimeError("Failed to create %s/.matplotlib;
consider setting MPLCONFIGDIR to a writable directory for matplotlib
configuration data"%h)

PythonHandler trac.web.modpython_frontend: RuntimeError: Failed to
create //.matplotlib; consider setting MPLCONFIGDIR to a writable directory
for matplotlib configuration data

Ich weis mir keinen rat wie ich das Problem einkreisen kann. Weis hier einer
rat?

Viele Grüße,

Hubert Krause

############################
#Ein kleines testscript:

#!/usr/bin/python -v

print 'hallo welt'

wirft folgendes aus:

# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/lib/python2.4/site.pyc matches /usr/lib/python2.4/site.py
import site # precompiled from /usr/lib/python2.4/site.pyc
# /usr/lib/python2.4/os.pyc matches /usr/lib/python2.4/os.py
import os # precompiled from /usr/lib/python2.4/os.pyc
import posix # builtin
# /usr/lib/python2.4/posixpath.pyc matches /usr/lib/python2.4/posixpath.py
import posixpath # precompiled from /usr/lib/python2.4/posixpath.pyc
# /usr/lib/python2.4/stat.pyc matches /usr/lib/python2.4/stat.py
import stat # precompiled from /usr/lib/python2.4/stat.pyc
# /usr/lib/python2.4/UserDict.pyc matches /usr/lib/python2.4/UserDict.py
import UserDict # precompiled from /usr/lib/python2.4/UserDict.pyc
# /usr/lib/python2.4/copy_reg.pyc matches /usr/lib/python2.4/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.4/copy_reg.pyc
# /usr/lib/python2.4/types.pyc matches /usr/lib/python2.4/types.py
import types # precompiled from /usr/lib/python2.4/types.pyc
import japanese # directory /usr/lib/python2.4/site-packages/japanese
# /usr/lib/python2.4/site-packages/japanese/__init__.pyc
matches /usr/lib/python2.4/site-packages/japanese/__init__.py
import japanese # precompiled
from /usr/lib/python2.4/site-packages/japanese/__init__.pyc
import japanese.aliases #
directory /usr/lib/python2.4/site-packages/japanese/aliases
# /usr/lib/python2.4/site-packages/japanese/aliases/__init__.pyc
matches /usr/lib/python2.4/site-packages/japanese/aliases/__init__.py
import japanese.aliases # precompiled
from /usr/lib/python2.4/site-packages/japanese/aliases/__init__.pyc
import encodings # directory /usr/lib/python2.4/encodings
# /usr/lib/python2.4/encodings/__init__.pyc
matches /usr/lib/python2.4/encodings/__init__.py
import encodings # precompiled
from /usr/lib/python2.4/encodings/__init__.pyc
# /usr/lib/python2.4/codecs.pyc matches /usr/lib/python2.4/codecs.py
import codecs # precompiled from /usr/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/lib/python2.4/encodings/aliases.pyc
matches /usr/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled
from /usr/lib/python2.4/encodings/aliases.pyc
# /usr/lib/python2.4/new.pyc matches /usr/lib/python2.4/new.py
import new # precompiled from /usr/lib/python2.4/new.pyc
'import site' failed; traceback:
Traceback (most recent call last):
File "/usr/lib/python2.4/site.py", line 397, in ?
main()
File "/usr/lib/python2.4/site.py", line 382, in main
paths_in_sys = addsitepackages(paths_in_sys)
File "/usr/lib/python2.4/site.py", line 203, in addsitepackages
addsitedir(sitedir, known_paths)
File "/usr/lib/python2.4/site.py", line 166, in addsitedir
addpackage(sitedir, name, known_paths)
File "/usr/lib/python2.4/site.py", line 135, in addpackage
exec line
File "<string>", line 1, in ?
KeyError: 'matplotlib'
# /usr/lib/python2.4/warnings.pyc matches /usr/lib/python2.4/warnings.py
import warnings # precompiled from /usr/lib/python2.4/warnings.pyc
# /usr/lib/python2.4/linecache.pyc matches /usr/lib/python2.4/linecache.py
import linecache # precompiled from /usr/lib/python2.4/linecache.pyc
# /usr/lib/python2.4/encodings/utf_8.pyc
matches /usr/lib/python2.4/encodings/utf_8.py
import encodings.utf_8 # precompiled
from /usr/lib/python2.4/encodings/utf_8.pyc
Python 2.4.3 (#1, Jul 27 2009, 17:57:39)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
hallo welt
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] _codecs
# cleanup[1] new
# cleanup[1] zipimport
# cleanup[1] matplotlib.toolkits
# cleanup[1] warnings
# cleanup[1] japanese
# cleanup[1] signal
# cleanup[1] linecache
# cleanup[1] posix
# cleanup[1] japanese.aliases
# cleanup[1] encodings
# cleanup[1] encodings.utf_8
# cleanup[1] codecs
# cleanup[1] types
# cleanup[1] encodings.aliases
# cleanup[1] exceptions
# cleanup[2] copy_reg
# cleanup[2] posixpath
# cleanup[2] os.path
# cleanup[2] stat
# cleanup[2] UserDict
# cleanup[2] os
# cleanup sys
# cleanup __builtin__
# cleanup ints: 4 unfreed ints in 1 out of 3 blocks
# cleanup floats
 

Lesen sie die antworten

#1 Diez B. Roggisch
31/08/2009 - 17:59 | Warnen spam
Hubert Krause wrote:

Hallo alle,

seit einem Python Update unter CentOS (Python 2.4) gibt es einen (oder
mehrere) seltsame Fehler. Ich bekomme immer die Meldung:
'import site' failed; use -v for traceback
die scripte funktionieren aber tadelos (yum zum beispiel) bis auf trac,
das die matplotlib nutzt und über einen falschen Pfad fürs homeverzeichnis
stolpert:

PythonHandler trac.web.modpython_frontend:
File "/usr/lib/python2.4/site-packages/matplotlib/__init__.py", line 439,
in _get_configdir raise RuntimeError("Failed to create
%s/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for
matplotlib configuration data"%h)

PythonHandler trac.web.modpython_frontend: RuntimeError: Failed to
create //.matplotlib; consider setting MPLCONFIGDIR to a writable
directory for matplotlib configuration data

Ich weis mir keinen rat wie ich das Problem einkreisen kann. Weis hier
einer rat?

Viele Grüße,

Hubert Krause

############################
#Ein kleines testscript:

#!/usr/bin/python -v

print 'hallo welt'

wirft folgendes aus:

# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/lib/python2.4/site.pyc matches /usr/lib/python2.4/site.py
import site # precompiled from /usr/lib/python2.4/site.pyc
# /usr/lib/python2.4/os.pyc matches /usr/lib/python2.4/os.py
import os # precompiled from /usr/lib/python2.4/os.pyc
import posix # builtin
# /usr/lib/python2.4/posixpath.pyc matches /usr/lib/python2.4/posixpath.py
import posixpath # precompiled from /usr/lib/python2.4/posixpath.pyc
# /usr/lib/python2.4/stat.pyc matches /usr/lib/python2.4/stat.py
import stat # precompiled from /usr/lib/python2.4/stat.pyc
# /usr/lib/python2.4/UserDict.pyc matches /usr/lib/python2.4/UserDict.py
import UserDict # precompiled from /usr/lib/python2.4/UserDict.pyc
# /usr/lib/python2.4/copy_reg.pyc matches /usr/lib/python2.4/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.4/copy_reg.pyc
# /usr/lib/python2.4/types.pyc matches /usr/lib/python2.4/types.py
import types # precompiled from /usr/lib/python2.4/types.pyc
import japanese # directory /usr/lib/python2.4/site-packages/japanese
# /usr/lib/python2.4/site-packages/japanese/__init__.pyc
matches /usr/lib/python2.4/site-packages/japanese/__init__.py
import japanese # precompiled
from /usr/lib/python2.4/site-packages/japanese/__init__.pyc
import japanese.aliases #
directory /usr/lib/python2.4/site-packages/japanese/aliases
# /usr/lib/python2.4/site-packages/japanese/aliases/__init__.pyc
matches /usr/lib/python2.4/site-packages/japanese/aliases/__init__.py
import japanese.aliases # precompiled
from /usr/lib/python2.4/site-packages/japanese/aliases/__init__.pyc
import encodings # directory /usr/lib/python2.4/encodings
# /usr/lib/python2.4/encodings/__init__.pyc
matches /usr/lib/python2.4/encodings/__init__.py
import encodings # precompiled
from /usr/lib/python2.4/encodings/__init__.pyc
# /usr/lib/python2.4/codecs.pyc matches /usr/lib/python2.4/codecs.py
import codecs # precompiled from /usr/lib/python2.4/codecs.pyc
import _codecs # builtin
# /usr/lib/python2.4/encodings/aliases.pyc
matches /usr/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled
from /usr/lib/python2.4/encodings/aliases.pyc
# /usr/lib/python2.4/new.pyc matches /usr/lib/python2.4/new.py
import new # precompiled from /usr/lib/python2.4/new.pyc
'import site' failed; traceback:
Traceback (most recent call last):
File "/usr/lib/python2.4/site.py", line 397, in ?
main()
File "/usr/lib/python2.4/site.py", line 382, in main
paths_in_sys = addsitepackages(paths_in_sys)
File "/usr/lib/python2.4/site.py", line 203, in addsitepackages
addsitedir(sitedir, known_paths)
File "/usr/lib/python2.4/site.py", line 166, in addsitedir
addpackage(sitedir, name, known_paths)
File "/usr/lib/python2.4/site.py", line 135, in addpackage
exec line
File "<string>", line 1, in ?
KeyError: 'matplotlib'



Setz doch mal breakpoints (import pdb; pdb.set_trace()) in das site.py. Dann
siehst du, was kaputt ist.

Diez

Ähnliche fragen