Alignak-monitoring-contrib / alignak-webui

Web User Interface for Alignak monitoring framework
GNU Affero General Public License v3.0
8 stars 4 forks source link

ImportError: No module named 'alignak_webui' #377

Open bbcorp opened 5 years ago

bbcorp commented 5 years ago

Hey there, I just installed alignak & alignak-webui on debian 9 from https://dl.bintray.com/alignak/alignak-deb-stable alignak runs fine but alignak-webui throw an error about alignak_webui module :

ImportError: No module named 'alignak_webui'
unable to load app 0 (mountpoint='') (callable not found or import error)
Traceback (most recent call last):
  File "/usr/local/share/alignak-webui/etc/alignak-webui.wsgi", line 6, in <module>
    from alignak_webui.app import session_app as application

I installed theses packages : python3-alignak python3-alignak-backend python3-alignak-webui I also tried installing alignak-webui with pip3 but it's not better. Do you have a clue ?

EDIT: here's package version : python3-alignak : 2.1.2 python3-alignak-backend : 1.4.16 python3-alignak-webui : 0.12.0

mohierf commented 5 years ago

Hi The wsgi configuration file requires that you indicate where uWSGI can load the alignak_webui module. The dafult configuration is loading: from alignak_webui.app import session_app as application which is the most common install location ... but it may be installed in a different place that is not in the default Python path

Search for a directory alignak_webui on your system and update the wsgi file accordingly... the insatlled wsgi file states:

# Uncomment and update to force a specific Python interpreter
# Else, let use the default system Python interpreter
# import sys
# sys.path.append('/usr/local/lib/python2.7/site-packages/alignak_webui')

from alignak_webui.app import session_app as application
bbcorp commented 5 years ago

Hi Frédéric, I had it running with path like this without alignak_webui directory : sys.path.append('/usr/local/lib/python3.6/site-packages')

Maybe full path will work by modifying import to (I didn't try it) : from app import session_app as application

By the way my problem is caused by having python2.7 and python3.x at the same time and python is still searching in 2.7 packages. I'll keep digging in order to fix this problem :-)

Jorilx commented 4 years ago

This happens because the deb files for Alignak install it inside /usr/local/lib/pythonX.Y/site-packages, but Debian's Python do not use site-packages by default, only dist-packages (see here). So indeed you have to tell Python to look there too, I think the easiest way is to just set PYTHONPATH: PYTHONPATH=/usr/local/lib/python3.6/site-packages