我切换到一台新机器,并尝试使用我的代码(在前一台机器上运行的代码(。我正在使用以下版本的python/django/Theano/Keras(当然与以前的机器对齐…(:
- Django==1.9.6
- django-cors标头==1.1.0
- django用户代理==0.3.0
- Keras==1.0.3
- python apt===0.9.3.5ubuntu2
- python dateutil==2.5.3
- python debian===0.1.21-nmu2ubuntu2
- scipy==0.17.1
- Theano==0.8.2
在其中一个导入中,我得到以下错误:(注意,在其他情况下,我得到了丢失gof的错误…但这可能是一个不同的问题(
-
最后一条导入失败线:
AttributeError: 'module' object has no attribute 'poll'
有什么想法吗?谢谢
- 简短版本:
File "/home/django/django_project/textlab/mainClasses/UploadNewSetCluster2TLChosen.py", line 10, in <module>
from keras.models import model_from_json
File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 2, in <module>
from . import backend
File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 51, in <module>
from .theano_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 1, in <module>
import theano
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 42, in <module>
from theano.configdefaults import config
File "/usr/local/lib/python2.7/dist-packages/theano/configdefaults.py", line 1452, in <module>
p_out = output_subprocess_Popen([config.cxx, '-dumpversion'])
File "/usr/local/lib/python2.7/dist-packages/theano/misc/windows.py", line 78, in output_subprocess_Popen
out = p.communicate()
File "/usr/lib/python2.7/subprocess.py", line 799, in communicate
return self._communicate(input)
File "/usr/lib/python2.7/subprocess.py", line 1401, in _communicate
stdout, stderr = self._communicate_with_poll(input)
File "/usr/lib/python2.7/subprocess.py", line 1431, in _communicate_with_poll
poller = select.poll()
AttributeError: 'module' object has no attribute 'poll'
- 完整版
[05/Aug/2016 08:22:50] ERROR [/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py:284] Internal Server Error: /dashboardeventreport Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 123, in get_response response = middleware_method(request) File "/usr/local/lib/python2.7/dist-packages/django/middleware/common.py", line 61, in process_request if self.should_redirect_with_slash(request): File "/usr/local/lib/python2.7/dist-packages/django/middleware/common.py", line 79, in should_redirect_with_slash not urlresolvers.is_valid_path(request.path_info, urlconf) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 668, in is_valid_path resolve(path, urlconf) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 534, in resolve return get_resolver(urlconf).resolve(path) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 374, in resolve for pattern in self.url_patterns: File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 417, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 410, in urlconf_module return import_module(self.urlconf_name) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/django/django_project/django_project/urls.py", line 17, in <module> from textlab import views File "/home/django/django_project/textlab/views.py", line 43, in <module> from mainClasses import UploadNewSetCluster2TLChosen File "/home/django/django_project/textlab/mainClasses/UploadNewSetCluster2TLChosen.py", line 10, in <module> from keras.models import model_from_json File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 2, in <module> from . import backend File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 51, in <module> from .theano_backend import * File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 1, in <module> import theano File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 42, in <module> from theano.configdefaults import config File "/usr/local/lib/python2.7/dist-packages/theano/configdefaults.py", line 1452, in <module> p_out = output_subprocess_Popen([config.cxx, '-dumpversion']) File "/usr/local/lib/python2.7/dist-packages/theano/misc/windows.py", line 78, in output_subprocess_Popen out = p.communicate() File "/usr/lib/python2.7/subprocess.py", line 799, in communicate return self._communicate(input) File "/usr/lib/python2.7/subprocess.py", line 1401, in _communicate stdout, stderr = self._communicate_with_poll(input) File "/usr/lib/python2.7/subprocess.py", line 1431, in _communicate_with_poll poller = select.poll() AttributeError: 'module' object has no attribute 'poll'
已解决!这个问题是古尼康版本。gunicorn没有使用pip-freet列出,因此如果版本一致,我没有列出。无论如何,这条线解决了问题:
sudo pip install gunicorn==19.4.5
请注意,您可能会在.teano文件夹的权限方面遇到一些问题。在这种情况下,只需使用:
sudo chown django:django <your django folder>
谢谢!