0

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?

asked Oct 25, 2009 at 20:36
1
  • Why not reformulate your question and post your answer and accept it. Like that it won't show up as "unanswered" anymore. Commented Oct 25, 2009 at 21:34

2 Answers 2

1

Add a file __init__.py into your directory, where you already have pkg_resources.py module. It will work for you .

answered Jul 20, 2012 at 9:25
Sign up to request clarification or add additional context in comments.

Comments

0

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.

answered Oct 25, 2009 at 21:48

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.