virtual Env kaputt?

Django, Flask, Bottle, WSGI, CGI…
Antworten
taake
User
Beiträge: 125
Registriert: Donnerstag 14. Oktober 2010, 08:49

Moin,
ich hab hier ein ziemlich stranges Problem und hoffe auf einen Denkanstoß seit kurz vor Ostern denke ich mal läuft virtualenv nicht mehr, da hatte ich wenn ich mich recht entsinne ein Upgrade von Werkzeug gemacht.

Das Problem ist nun das es einen Import Error gibt den ich nicht wirklich nachvollziehen kann.
Hier mal der Aussazug aus dem uwsgi log:
mapped 1237120 bytes (1208 KB) for 40 cores
*** Operational MODE: preforking+threaded ***
added /var/www/localhost/flask/env/ to pythonpath.
added /var/www/localhost/flask/env/lib/python2.7/ to pythonpath.
added /var/www/localhost/flask/env/lib/python2.7/site-packages/ to pythonpath.
Traceback (most recent call last):
File "./server_start.py", line 1, in <module>
from app import app
File "./app/__init__.py", line 1, in <module>
from flask import Flask
File "/var/www/localhost/flask/env/lib/python2.7/site-packages/flask/__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "/var/www/localhost/flask/env/lib/python2.7/site-packages/werkzeug/__init__.py", line 20, in <module>
from werkzeug._compat import iteritems
File "/var/www/localhost/flask/env/lib/python2.7/site-packages/werkzeug/_compat.py", line 2, in <module>
import operator
ImportError: No module named operator
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
Okay soweit sogut operator ist aber importierbar wenn ich es von Hand versuche.

Code: Alles auswählen

Srv03 # . /var/www/localhost/flask/env/bin/activate
Python 2.7.9 (default, Feb 10 2015, 15:42:31) 
[GCC 4.8.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import app
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named app
>>> from app import app
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named app
>>> from flask import Flask
>>> import operator
>>> 
Hier gibt es kein Probleme beim importen von operator

Ebenso wenn ich mit dem VirtualEnv direkt den server Starte.
(env)Srv03 # python /var/www/localhost/flask/bildersuche/server_start.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Daher stehe ich etwas auf dem Schlauch was jetzt das Problem ist.
Hier noch ein paar Sachen die ggf. weiterhelfen:

dev-python/virtualenv
Installed versions: 1.11.6(15:55:14 10.02.2015)(-doc -test PYTHON_TARGETS="python2_7 python3_3 -pypy -pypy3 -python3_4")

pip list
Flask (0.10.1)
Flask-Login (0.2.11)
Flask-SQLAlchemy (2.0)
Flask-WTF (0.11)
GeoIP (1.3.2)
itsdangerous (0.24)
Jinja2 (2.7.3)
MarkupSafe (0.23)
MySQL-python (1.2.5)
pip (6.1.0)
pip-tools (0.3.5)
setuptools (15.0)
SQLAlchemy (0.9.9)
Werkzeug (0.10.4)
WTForms (2.0.2)
Hat noch Jemand das Problem oder ggf. Sachdienliche Hinweise, zur Zeit läuft das Ganze, da ich das virtualenv rausgenommen habe
was natürlich keine Dauerlösung darstellt.
jerch
User
Beiträge: 1669
Registriert: Mittwoch 4. März 2009, 14:19

@taake:
Wie startet denn der Server die virtuelle Umgebung? Da würde ich ansetzen.
taake
User
Beiträge: 125
Registriert: Donnerstag 14. Oktober 2010, 08:49

Ich übergebe uwsgi ne xml zum Start mit den Parametern, denke eher nicht das hier irgendwas im argen ist.

Code: Alles auswählen

<uwsgi>
    <socket>127.0.0.1:9191</socket>
    <chdir>/var/www/localhost/flask/bildersuche/</chdir>
    <module>server_start</module>
    <callable>app</callable>
    <threads>10</threads>
    <processes>4</processes>
    <post-buffering>8192</post-buffering>
    <harakiri>600</harakiri>
<!--    <virtualenv>/var/www/localhost/flask/env/</virtualenv> 
    <pythonpath>/var/www/localhost/flask/env/</pythonpath> 
    <pythonpath>/var/www/localhost/flask/env/lib/python2.7</pythonpath> 
    <pythonpath>/var/www/localhost/flask/env/lib/python2.7/site-packages/</pythonpath> -->
    <disable-logging>true</disable-logging>
    <uid>nginx</uid>
    <gid>nginx</gid>
</uwsgi>
Also natürlich war der Part vorher nicht auskommentiert.
Es ergibt für mich nur einfach keinen Sinn das ich das ganze wenn ich mich in die env chroote starten kann, aber wenn ich es über wsgi mache er import probleme hat.
Zumal er laut uwsgi log die Sachen ja auch korrekt setzt.

uwsgi selbst kann ich wohl ausschließen, da ich das ganze mitte letzten Monats geupdated hatte und es dort alles lief.

www-servers/uwsgi
Installed versions: 2.0.9(10:55:13 16.03.2015)

Weiß wer ob man mit pip downgraden kann?
Da ich kurz vor Ostern die werkzeug version im env geupdated habe.
Zuletzt geändert von Anonymous am Mittwoch 8. April 2015, 09:15, insgesamt 1-mal geändert.
Grund: Quelltext in XML-Code-Tags gesetzt.
BlackJack

@taake: Du kannst bei ``pip`` angeben welche Version Du installieren möchtest, also auch eine ältere als die aktuelle.
taake
User
Beiträge: 125
Registriert: Donnerstag 14. Oktober 2010, 08:49

Danke für eure Hilfe, wurde mir aber alles zu bunt, so das es einfacher war das ganze virtualenv zu nuken und neu zubauen.
Jetzt läuft es auch wieder sauber.

Trotzdem danke ;)
Antworten