2016-08-05 46 views
0

Ich habe zu einer neuen Maschine gewechselt und versucht, meinen Code (der auf der vorherigen arbeitet). Ich verwende Python/Django/Theano/Keras mit den folgenden Versionen (ausgerichtet mit der vorherige Maschine natürlich ...):Import Problem mit Theano: AttributeError: 'Modul' Objekt hat kein Attribut 'Abfrage'

  • Django == 1.9.6
  • django-cors-headers = = 1.1.0
  • django-User-Agents == 0.3.0
  • Keras == 1.0.3
  • Python-apt === 0.9.3.5ubuntu2
  • Python-dateutil == 2.5.3
  • python-debian === 0.1.21-nmu2ubun TU2
  • scipy == 0.17.1
  • Theano == 0.8.2

Auf einer der Import ich die folgende Fehlermeldung erhalten: (Beachten Sie, dass in anderen Fällen habe ich den Fehler der fehlenden gof ... aber das könnte eine andere Frage sein)

  • Letzter Import Fail-Reihe:

    AttributeError: 'module' object has no attribute 'poll' 
    

Irgendwelche Ideen? Danke!

  • Kurzversion:

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'

  • Vollversion [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'
+0

Von der [docs] (https://docs.python.org/2/library/select.html#select.poll), die Sie immer überprüfen sollten, bevor Sie hier fragen: "' select.poll() ': (Wird nicht von allen Betriebssystemen unterstützt.) "Ist Ihre neue Maschine auf einem anderen Betriebssystem als Ihrer alten? – user2357112

+0

Genau das gleiche: Ubuntu 14.04.4 LTS – Daniel

+0

Stellen Sie sicher, dass Sie keinen Namen vergeben, der ein eingebautes Modul wie 'select.py' oder etwas verbergen würde, und versuchen Sie' import select' und inspection 'select .__ file__' und 'hasattr (select, 'poll')'. – user2357112

Antwort

0

gelöst! Das Problem war Gunicorn-Version. Gunicorn wurde nicht mit Pip Freeze aufgelistet - daher habe ich nicht, wenn die Versionen ausgerichtet sind. Wie dem auch sei - diese Zeile löst das Problem:

sudo pip install gunicorn==19.4.5 

Beachten Sie, dass für .theano Ordner einige Probleme mit Berechtigungen möglicherweise haben werden. In diesem Fall benutzen Sie einfach:

sudo chown django:django <your django folder> 

Dank!