Problems with ImportError: cannot import name interfaces on Ubuntu 10.04 apache WSGI deployment

410 views
Skip to first unread message

Shane

unread,
Dec 9, 2012, 3:17:46 PM12/9/12
to turbo...@googlegroups.com
Hello,

I am testing the deployment of an application under:

Ubuntu: 10.04
TG2.2.0
Apache/2.2.14 (Ubuntu) mod_wsgi/2.8

Intermittently (say every 48 hours of so), the app crashes with the following:

[Sun Dec 09 14:37:49 2012] [error] mod_wsgi (pid=23383): Target WSGI script '/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/apache/MyAPP.wsgi' cannot be loaded as Python module.
[Sun Dec 09 14:37:49 2012] [error] mod_wsgi (pid=23383): Exception occurred processing WSGI script '/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/apache/MyAPP.wsgi'.
[Sun Dec 09 14:37:49 2012] [error] Traceback (most recent call last):
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/apache/MyAPP.wsgi", line 49, in <module>
[Sun Dec 09 14:37:49 2012] [error] application = loadapp('config:/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/alpha-production.ini')
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
[Sun Dec 09 14:37:49 2012] [error] return loadobj(APP, uri, name=name, **kw)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 271, in loadobj
[Sun Dec 09 14:37:49 2012] [error] global_conf=global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 296, in loadcontext
[Sun Dec 09 14:37:49 2012] [error] global_conf=global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 320, in _loadconfig
[Sun Dec 09 14:37:49 2012] [error] return loader.get_context(object_type, name, global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 454, in get_context
[Sun Dec 09 14:37:49 2012] [error] section)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 476, in _context_from_use
[Sun Dec 09 14:37:49 2012] [error] object_type, name=use, global_conf=global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 406, in get_context
[Sun Dec 09 14:37:49 2012] [error] global_conf=global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 296, in loadcontext
[Sun Dec 09 14:37:49 2012] [error] global_conf=global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 328, in _loadegg
[Sun Dec 09 14:37:49 2012] [error] return loader.get_context(object_type, name, global_conf)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 620, in get_context
[Sun Dec 09 14:37:49 2012] [error] object_type, name=name)
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
[Sun Dec 09 14:37:49 2012] [error] possible.append((entry.load(), protocol, entry.name))
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/BASELINE2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1954, in load
[Sun Dec 09 14:37:49 2012] [error] entry = __import__(self.module_name, globals(),globals(), ['__name__'])
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/MyAPP/config/middleware.py", line 4, in <module>
[Sun Dec 09 14:37:49 2012] [error] from MyAPP.config.app_cfg import base_config
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/MyAPP/config/app_cfg.py", line 19, in <module>
[Sun Dec 09 14:37:49 2012] [error] from MyAPP import model
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/MyAPP-R2.2.1/MyAPP/model/__init__.py", line 4, in <module>
[Sun Dec 09 14:37:49 2012] [error] from zope.sqlalchemy import ZopeTransactionExtension
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/zope.sqlalchemy-0.7.1-py2.7.egg/zope/sqlalchemy/__init__.py", line 17, in <module>
[Sun Dec 09 14:37:49 2012] [error] from zope.sqlalchemy.datamanager import ZopeTransactionExtension, mark_changed
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/zope.sqlalchemy-0.7.1-py2.7.egg/zope/sqlalchemy/datamanager.py", line 15, in <module>
[Sun Dec 09 14:37:49 2012] [error] import transaction as zope_transaction
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/transaction-1.3.0-py2.7.egg/transaction/__init__.py", line 19, in <module>
[Sun Dec 09 14:37:49 2012] [error] from transaction._transaction import Transaction
[Sun Dec 09 14:37:49 2012] [error] File "/usr/local/pythonenv/TG2.2ENV/lib/python2.7/site-packages/transaction-1.3.0-py2.7.egg/transaction/_transaction.py", line 115, in <module>
[Sun Dec 09 14:37:49 2012] [error] from transaction import interfaces
[Sun Dec 09 14:37:49 2012] [error] ImportError: cannot import name interfaces

The problem seems similar to that in http://osdir.com/ml/turbogears/2011-03/msg00052.html, but I did install the VE with --no-site-packages and within my environment, I can run python -c 'from transaction import interfaces' w/o an error.  It does not seem to be a problem with a missing package.  transaction-1.3.0 seems to be the current requirement (I easy_installed it just to be sure and that was the version present).  I ad the same problem with the same app with TG2.0 deployment and was hoping the upgrade to TG2.2 would fix it, but so far no luck.

I have a cron job that restarts apache every night and that seems to work OK, but looking for the cause of the problem.

Any ideas? 

Thanks,

Shane

Michael Pedersen

unread,
Jan 2, 2013, 12:46:13 AM1/2/13
to tg-trunk
I was going to suggest upgrading to mod_wsgi 3.4, but I've just checked: We only ship transaction 1.1.1 by default still. See http://www.turbogears.org/2.2/downloads/2.2.0/index/transaction/index.html

It's been a few months since I've cut a new release, but I seem to recall going to higher versions of transactions as presenting problems. I'd suggest downgrading to transactions 1.1.1 (from your VE, "easy_install transactions==1.1.1"), and use that version. I'd expect that to fix it pretty quickly.



--
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To view this discussion on the web visit https://groups.google.com/d/msg/turbogears/-/9NU8oS_jHT4J.
To post to this group, send email to turbo...@googlegroups.com.
To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.



--
Michael J. Pedersen
My Online Resume: http://www.icelus.org/ -- Google+ http://plus.ly/pedersen
Google Talk: m.ped...@icelus.org -- Twitter: pedersentg

Stuart Zurcher

unread,
Feb 12, 2014, 10:05:52 AM2/12/14
to turbo...@googlegroups.com
I've been fighting this same issue for about a month with it happening intermittently...once or twice a week or every other week.

I changed to transactions-1.1.1.

Still get the interfaces import error.  When it restarts, it has RuntimeError: class.__dict__ not accessible in restricted mode

Based on recommendation from http://stackoverflow.com/questions/10557930/mod-wsgi-error-class-dict-not-accessible-in-restricted-mode, I added the following to /etc/apache2/sites-enabled/
project:

     WSGIProcessGroup %{GLOBAL}

Any one else had this problem and soved it?

Stuart Zurcher

unread,
Feb 12, 2014, 10:16:46 AM2/12/14
to turbo...@googlegroups.com
Listen 8080
 
/etc/apache2/sites-enabled/MCPCS file

NameVirtualHost 10.81.27.21:8080
 
<VirtualHost 10.81.27.21:8080>
ServerName vmusjzdev2.co.marshall.ia.us
 
DocumentRoot /var/www/MCPCS
# WSGIProcessGroup MCPCS
# WSGIDaemonProcess MCPCS python-path=/opt/TG23MCPCS-env/lib/python2.7/site-packages
WSGIProcessGroup %{GLOBAL}
WSGIScriptAlias / /opt/MCPCS/apache/MCPCS.wsgi
WSGIPassAuthorization On
 
Alias /images /opt/MCPCS/mcispis/public/images
Alias /css /opt/MCPCS/mcispis/public/css
Alias /javascript /opt/MCPCS/mcispis/public/javascript
Alias /media /opt/MCPCS/mcispis/public/media
 
 
<Directory /opt/MCPCS/apache>
Order deny,allow
Allow from all
</Directory>
 
ErrorLog /var/log/apache2/MCPCS/error.log
LogLevel warn
CustomLog /var/log/apache2/MCPCS/access.log combined
 
 
</VirtualHost>


Stuart Zurcher
1134 Spencer St.
Grinnell, IA 50112


--
You received this message because you are subscribed to a topic in the Google Groups "TurboGears" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/turbogears/_rWr62jcRqw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to turbogears+...@googlegroups.com.

To post to this group, send email to turbo...@googlegroups.com.

Shane

unread,
Sep 20, 2017, 10:36:14 AM9/20/17
to TurboGears
Stuart,

I have a similar problem.  Can you tell me if you ever found a fix?

- Shane

Stuart Zurcher

unread,
Sep 20, 2017, 2:25:30 PM9/20/17
to TurboGears
@shane
I did, but no longer have access to the project. Sorry.

I think it had to do with how the dependencies were put in the project.

Reply all
Reply to author
Forward
0 new messages