From: John <was...@gm...> - 2008-03-28 01:03:27
|
Hello, could someone please help me understand a strange problem, possibly associated with PYTHONPATH. When I import matplotlib, pylab, or scipy from any directory other than the root installation directory, it fails. However, if I'm in the python installation directory there are no errors. Thanks in advance! Please see below: *[jfb@andLinux ~]$ python* Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import scipy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/site-packages/scipy/__init__.py", line 18, in <module> import pkg_resources as _pr # activate namespace packages (manipulates __path__) File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, in <module> add_activation_listener(lambda dist: dist.activate()) File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 640, in subscribe callback(dist) File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2581, in <lambda> add_activation_listener(lambda dist: dist.activate()) File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 2130, in activate map(declare_namespace, self._get_metadata('namespace_packages.txt')) File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1749, in declare_namespace _handle_ns(packageName, path_item) File "/usr/lib/python2.5/site-packages/pkg_resources.py", line 1712, in _handle_ns module = sys.modules[packageName] = new.module(packageName) AttributeError: 'module' object has no attribute 'module' >>> *[jfb@andLinux ~]$ cd /usr/lib/python2.5/ [jfb@andLinux python2.5]$ python* Python 2.5.1 (r251:54863, Mar 7 2008, 04:10:12) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import scipy >>> *[jfb@andLinux python2.5]$ cd [jfb@andLinux ~]$ echo $PYTHONPATH* :.:/usr/lib/python2.5/:.:/home/jfb/bin *[jfb@andLinux ~]$* |