Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This borders on stackoverflow/superuser, but I guess it's a simple installation problem.

I've installed python-twisted on my ubuntu 10.04 server, but it can't be found.

This is what I get when I try to import something:

>>> from twisted.internet import reactor
Traceback (most recent call last):
  File "", line 1, in 
  File "twisted.py", line 1, in 
    from twisted.internet import reactor
ImportError: No module named internet

I've installed the package through apt-get. That way the module is installed in this folder: /usr/lib/python2.6/dist-packages/twisted with an __init__.py file.

When I try to use python setup.py install (on the download from the site) it installs it to /usr/local/lib/python2.6/dist-packages/twisted, but it also does not find it there.

Does anyone know where it went wrong? Google isn't spilling anything.

share|improve this question
1  
Does just import twisted work? – Josh Hunt Jul 10 '10 at 1:14
1  
How did you install python-twisted? apt-get, easy_install, setup.py install? – fideli Jul 10 '10 at 1:29
    
I installed it through apt-get, yeah. Didn't really see the point in doing it through setup.py. And since nobody else has ever reported this problem with twisted before I thought I must be doing something wrong. Just importing twisted also does not work. It gives the same error "ImportError: No module named internet" – skerit Jul 10 '10 at 11:05
    
The package from apt-get installs twisted into the /usr/lib/python2.6/dist-packages/twisted directory, with a init.py file in it. So that should work! To test it out, I removed it and installed it through python setup.py installbut it installed it into /usr/local/lib/python2.6/dist-packages/twisted – skerit Jul 10 '10 at 11:49
up vote 2 down vote accepted

You seem to have a twisted.py file that shadows the correct imports. Rename it. You can use absolute imports (from __future__ import absolute_imports), if you want your own module to be available as myapp.twisted.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .