python setup.py installI would receive the following error:
Traceback (most recent call last):I already managed to solve this problem some time ago, but it reappeared and it was driving me nuts! And I forgot what I did! Googling didn't tell me a lot. So, I had to look into the code.
File "setup.py", line 1, in
from setuptools import setup, find_packages
File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 2, in
from setuptools.extension import Extension, Library
File "/usr/lib/python2.7/site-packages/setuptools/extension.py", line 5, in
from setuptools.dist import _get_unpatched
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 6, in
from setuptools.command.install import install
File "/usr/lib/python2.7/site-packages/setuptools/command/__init__.py", line 8, in
from setuptools.command import install_scripts
File "/usr/lib/python2.7/site-packages/setuptools/command/install_scripts.py", line 3, in
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2755, in
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 704, in subscribe
callback(dist)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2755, in
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2258, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1847, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1817, in _handle_ns
loader.load_module(packageName); module.__path__ = path
File "/usr/lib64/python2.7/pkgutil.py", line 246, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/usr/lib/python2.7/site-packages/chameleon/__init__.py", line 1, in
from .zpt.template import PageTemplate
File "/usr/lib/python2.7/site-packages/chameleon/zpt/template.py", line 9, in
from ..i18n import fast_translate
ImportError: cannot import name fast_translate
I had to search modules on disk, use print to see which one is actually loaded, and rpm/yum to query packages, but to cut the story short, in the end I found out that I had some dangling files and directories, probably because I did upgrade instead of clean install.The following ones were offending ones:
/usr/lib/python2.7/site-packages/chameleon/astThis is easy to verify. Using 'rpm -qf <dir_or_file' shows for all of them (including files in those directories) that they are not owned by any package. So, I simply removed then and suddenly everything worked!
/usr/lib/python2.7/site-packages/chameleon/core
/usr/lib/python2.7/site-packages/chameleon/genshi
/usr/lib/python2.7/site-packages/chameleon/i18n