on ec2
If you see this message it means that zope.interface is available but has raised some reason why it might not work.
The code that imports zope.interface is shown below
# Don't allow the user to run with a version of zope.interface we don't
# support.
required = "Twisted requires zope.interface %s or later" % (required,)
try:
from zope import interface
except ImportError:
# It isn't installed.
raise ImportError(required + ": no module named zope.interface.")
except:
# It is installed but not compatible with this version of Python.
raise ImportError(required + ".")
reinstalling the same version of zope.interface will probably not solve the issue but might be worth a shot. uninstall zope.interface first and then make sure there's no zope.interface stuff in you python site-packages directory before installing with pip install zope.interface
.
The asker could try an alternative version of zope.interface but I think the issue is more likely related to the way python is installed on the system or that twisted is not installed correctly. You could try uninstalling pip uninstall twisted
and then reinstalling twisted pip install twisted
likely solution
The easiest way to resolve the problem would be to run the application within a virtual environment and control which packages are installed. see the documentation here: https://virtualenv.pypa.io/en/latest/
for example you could install venv using pip and then install twisted into it
pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install twisted
deactivate
you can try a different version of python than the system default with something like this
virtualenv -p /usr/bin/python2.7 venv
AWS Lambda
I ran into a similar issue when trying to run twisted on aws lambda.
I found that zope.interface could not be imported when installed using pip in a venv. It looked like some stuff was missing which meant it couldn't be imported normally as a module in my zip package but would probably work in the venv. removing it from site packages and replacing it with the source files solved my issue.
https://pypi.python.org/pypi/zope.interface/4.1.3#downloads
The current version at this time is zope.interface-4.1.3.tar.gz