I've got a trac installation which works correctly from the command line. I deployed the trac.cgi to the proper directory, but when I open the page, I get:
Trac detected an internal error: No module named pkg_resources
Traceback (most recent call last):
File "/some/path/htdocs/trac.cgi", line 22, in ?
import pkg_resources
ImportError: No module named pkg_resources
pkg_resources is installed. I can import it when I run python from the command line. Permissions are right (I can read the site-packages/pkg_resources.py). The sys.path is right (includes the site-packages directory). The file starts with:
try:
import os
import pkg_resources
so paths are not modified before the failure.
Is there some other case where the import can fail this way?
-
Why not reformulate your question and post your answer and accept it. Like that it won't show up as "unanswered" anymore.exhuma– exhuma2009年10月25日 21:34:12 +00:00Commented Oct 25, 2009 at 21:34
2 Answers 2
Add a file __init__.py into your directory, where you already have pkg_resources.py module. It will work for you .
Comments
I found the answer in the end. The script was run on a cluster - since I was using a virtual-python installation, some symlinks were not resolvable on other nodes. They were ok only on the machine that I was testing.
Installing setuptools in a folder created by virtual-python (i.e. in a directory that is replicated between all the servers) solved it.