Graphite-Web won't start

(Ruven G) #1

Hello everyone,

at the moment I am about to set up a new Icinga2 server and I thought I’d give Graphite a shot.

I am running graphite-web 1.0.2 (newest one I could source from our internal repos)
And it’s working together with Python 2.7.15+
According to pip list the Django version is Django (1.11.11)

Problem is that I can’t get graphite-web running - When I start my Apache2 it just dies with an exception in the graphite-web_error.log. It looks something like this:

[Wed Oct 16 13:55:08.567612 2019] [wsgi:error] [pid 24858] mod_wsgi (pid=24858): Target WSGI script ‘/usr/share/graphite-web/graphite.wsgi’ cannot be loaded as Python module.
[Wed Oct 16 13:55:08.567746 2019] [wsgi:error] [pid 24858] mod_wsgi (pid=24858): Exception occurred processing WSGI script ‘/usr/share/graphite-web/graphite.wsgi’.
[Wed Oct 16 13:55:08.578449 2019] [wsgi:error] [pid 24858] Traceback (most recent call last):
[Wed Oct 16 13:55:08.578508 2019] [wsgi:error] [pid 24858] File “/usr/share/graphite-web/graphite.wsgi”, line 11, in
[Wed Oct 16 13:55:08.578518 2019] [wsgi:error] [pid 24858] from django.conf import settings
[Wed Oct 16 13:55:08.578547 2019] [wsgi:error] [pid 24858] ModuleNotFoundError: No module named ‘django’
[Wed Oct 16 13:55:08.632697 2019] [wsgi:error] [pid 24862] mod_wsgi (pid=24862): Target WSGI script ‘/usr/share/graphite-web/graphite.wsgi’ cannot be loaded as Python module.
[Wed Oct 16 13:55:08.632818 2019] [wsgi:error] [pid 24862] mod_wsgi (pid=24862): Exception occurred processing WSGI script ‘/usr/share/graphite-web/graphite.wsgi’.
[Wed Oct 16 13:55:08.646958 2019] [wsgi:error] [pid 24859] mod_wsgi (pid=24859): Target WSGI script ‘/usr/share/graphite-web/graphite.wsgi’ cannot be loaded as Python module.
[Wed Oct 16 13:55:08.647066 2019] [wsgi:error] [pid 24859] mod_wsgi (pid=24859): Exception occurred processing WSGI script ‘/usr/share/graphite-web/graphite.wsgi’.
[Wed Oct 16 13:55:08.655979 2019] [wsgi:error] [pid 24862] Traceback (most recent call last):
[Wed Oct 16 13:55:08.656043 2019] [wsgi:error] [pid 24862] File “/usr/share/graphite-web/graphite.wsgi”, line 11, in
[Wed Oct 16 13:55:08.656054 2019] [wsgi:error] [pid 24862] from django.conf import settings
[Wed Oct 16 13:55:08.656083 2019] [wsgi:error] [pid 24862] ModuleNotFoundError: No module named ‘django’
[Wed Oct 16 13:55:08.658021 2019] [wsgi:error] [pid 24859] Traceback (most recent call last):
[Wed Oct 16 13:55:08.658081 2019] [wsgi:error] [pid 24859] File “/usr/share/graphite-web/graphite.wsgi”, line 11, in
[Wed Oct 16 13:55:08.658092 2019] [wsgi:error] [pid 24859] from django.conf import settings
[Wed Oct 16 13:55:08.658120 2019] [wsgi:error] [pid 24859] ModuleNotFoundError: No module named ‘django’
[Wed Oct 16 13:55:08.677334 2019] [wsgi:error] [pid 24857] mod_wsgi (pid=24857): Target WSGI script ‘/usr/share/graphite-web/graphite.wsgi’ cannot be loaded as Python module.
[Wed Oct 16 13:55:08.677437 2019] [wsgi:error] [pid 24857] mod_wsgi (pid=24857): Exception occurred processing WSGI script ‘/usr/share/graphite-web/graphite.wsgi’.
[Wed Oct 16 13:55:08.680611 2019] [wsgi:error] [pid 24863] mod_wsgi (pid=24863): Target WSGI script ‘/usr/share/graphite-web/graphite.wsgi’ cannot be loaded as Python module.
[Wed Oct 16 13:55:08.680695 2019] [wsgi:error] [pid 24863] mod_wsgi (pid=24863): Exception occurred processing WSGI script ‘/usr/share/graphite-web/graphite.wsgi’.
[Wed Oct 16 13:55:08.688255 2019] [wsgi:error] [pid 24857] Traceback (most recent call last):
[Wed Oct 16 13:55:08.688315 2019] [wsgi:error] [pid 24857] File “/usr/share/graphite-web/graphite.wsgi”, line 11, in
[Wed Oct 16 13:55:08.688325 2019] [wsgi:error] [pid 24857] from django.conf import settings
[Wed Oct 16 13:55:08.688354 2019] [wsgi:error] [pid 24857] ModuleNotFoundError: No module named ‘django’
[Wed Oct 16 13:55:08.691537 2019] [wsgi:error] [pid 24863] Traceback (most recent call last):
[Wed Oct 16 13:55:08.691596 2019] [wsgi:error] [pid 24863] File “/usr/share/graphite-web/graphite.wsgi”, line 11, in
[Wed Oct 16 13:55:08.691606 2019] [wsgi:error] [pid 24863] from django.conf import settings
[Wed Oct 16 13:55:08.691635 2019] [wsgi:error] [pid 24863] ModuleNotFoundError: No module named ‘django’

What I don’t understand is the error message. I have installed django, so that shouldn’t be a problem but i obviously is.

So I tried to install django with pip and this was the outcome:

Requirement already satisfied: django in /usr/lib/python2.7/dist-packages
Cleaning up…

I am probably just overlooking something but at this point I thought someone on this forum might be able to help me out.

Thanks in advance.

Regards,
Ruven

(Ruven G) #2

I have reogranized some packages that might have caused a mixup between python3 and 2 - By this I managed to sort out the django error.

I still get an error though. And under my designated port (8000) for graphite I get a HTTP 500.

The new errors looks something like this:

[Thu Oct 17 08:25:30.782420 2019] [wsgi:error] [pid 23594] mod_wsgi (pid=23594): Target WSGI script ‘/usr/share/graphite-web/graphite.wsgi’ cannot be loaded as Python module.
[Thu Oct 17 08:25:30.782452 2019] [wsgi:error] [pid 23594] mod_wsgi (pid=23594): Exception occurred processing WSGI script ‘/usr/share/graphite-web/graphite.wsgi’.
[Thu Oct 17 08:25:30.782472 2019] [wsgi:error] [pid 23594] Traceback (most recent call last):
[Thu Oct 17 08:25:30.782492 2019] [wsgi:error] [pid 23594] File “/usr/share/graphite-web/graphite.wsgi”, line 14, in
[Thu Oct 17 08:25:30.782550 2019] [wsgi:error] [pid 23594] application = get_wsgi_application()
[Thu Oct 17 08:25:30.782564 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py”, line 13, in get_wsgi_application
[Thu Oct 17 08:25:30.782601 2019] [wsgi:error] [pid 23594] django.setup(set_prefix=False)
[Thu Oct 17 08:25:30.782614 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/init.py”, line 27, in setup
[Thu Oct 17 08:25:30.782650 2019] [wsgi:error] [pid 23594] apps.populate(settings.INSTALLED_APPS)
[Thu Oct 17 08:25:30.782663 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/apps/registry.py”, line 108, in populate
[Thu Oct 17 08:25:30.782784 2019] [wsgi:error] [pid 23594] app_config.import_models()
[Thu Oct 17 08:25:30.782796 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/apps/config.py”, line 202, in import_models
[Thu Oct 17 08:25:30.782867 2019] [wsgi:error] [pid 23594] self.models_module = import_module(models_module_name)
[Thu Oct 17 08:25:30.782877 2019] [wsgi:error] [pid 23594] File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
[Thu Oct 17 08:25:30.782913 2019] [wsgi:error] [pid 23594] import(name)
[Thu Oct 17 08:25:30.782923 2019] [wsgi:error] [pid 23594] File “/usr/lib/python2.7/dist-packages/graphite/account/models.py”, line 16, in
[Thu Oct 17 08:25:30.782960 2019] [wsgi:error] [pid 23594] from django.contrib.auth import models as auth_models
[Thu Oct 17 08:25:30.782984 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py”, line 103, in
[Thu Oct 17 08:25:30.783097 2019] [wsgi:error] [pid 23594] class Group(models.Model):
[Thu Oct 17 08:25:30.783110 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/db/models/base.py”, line 162, in new
[Thu Oct 17 08:25:30.783516 2019] [wsgi:error] [pid 23594] new_class.add_to_class(obj_name, obj)
[Thu Oct 17 08:25:30.783528 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/db/models/base.py”, line 325, in add_to_class
[Thu Oct 17 08:25:30.783545 2019] [wsgi:error] [pid 23594] value.contribute_to_class(cls, name)
[Thu Oct 17 08:25:30.783555 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py”, line 1648, in contribute_to_class
[Thu Oct 17 08:25:30.783950 2019] [wsgi:error] [pid 23594] self.remote_field.through = create_many_to_many_intermediary_model(self, cls)
[Thu Oct 17 08:25:30.783968 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py”, line 1104, in create_many_to_many_intermediary_model
[Thu Oct 17 08:25:30.783987 2019] [wsgi:error] [pid 23594] ‘verbose_name’: (’%(from)s-%(to)s relationship’) % {‘from’: from, ‘to’: to},
[Thu Oct 17 08:25:30.783997 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/functional.py”, line 162, in mod
[Thu Oct 17 08:25:30.784109 2019] [wsgi:error] [pid 23594] return six.text_type(self) % rhs
[Thu Oct 17 08:25:30.784120 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/functional.py”, line 119, in __text_cast
[Thu Oct 17 08:25:30.784134 2019] [wsgi:error] [pid 23594] return func(*self.__args, **self.__kw)
[Thu Oct 17 08:25:30.784145 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/translation/init.py”, line 89, in ugettext
[Thu Oct 17 08:25:30.784221 2019] [wsgi:error] [pid 23594] return _trans.ugettext(message)
[Thu Oct 17 08:25:30.784231 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py”, line 345, in ugettext
[Thu Oct 17 08:25:30.784368 2019] [wsgi:error] [pid 23594] return do_translate(message, ‘ugettext’)
[Thu Oct 17 08:25:30.784379 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py”, line 321, in do_translate
[Thu Oct 17 08:25:30.784393 2019] [wsgi:error] [pid 23594] _default = _default or translation(settings.LANGUAGE_CODE)
[Thu Oct 17 08:25:30.784401 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py”, line 228, in translation
[Thu Oct 17 08:25:30.784413 2019] [wsgi:error] [pid 23594] _translations[language] = DjangoTranslation(language)
[Thu Oct 17 08:25:30.784420 2019] [wsgi:error] [pid 23594] File “/usr/local/lib/python2.7/dist-packages/django/utils/translation/trans_real.py”, line 134, in init
[Thu Oct 17 08:25:30.784431 2019] [wsgi:error] [pid 23594] raise IOError(“No translation files found for default language %s.” % settings.LANGUAGE_CODE)
[Thu Oct 17 08:25:30.784456 2019] [wsgi:error] [pid 23594] IOError: No translation files found for default language en-us.

The tracelog doesn’t seem to have any problems, until the “translation-file” problem - you wouldn’t think that this is that much of a problem but I can’t find anything helpful on the web.

Another thing I’ve noticed, is that according to the errorlog the wsgi is beeing started a number of times, because it logs the same messages several times on one startup. While I don’t think that is the problem, it still makes me curious.

(Ruven G) #3

Problem cleared itself up -

It was due to the sources of the python modules:
these were used: /usr/local/lib/python2.7/dist-packages

But that is not where they should be located, i made some links to where they are originally installed by PIP and everything works now.