After updating the Whisper package (from 0.9.12 to 1.1.1) using pip, I'm not able to access my Graphite instance anymore (even after downgrading...) The logs say the target script can't be loaded as a Python module.
Here are some informations about the system.
- Python version: 2.7
- Carbon, Graphite web, Whisper versions: 0.9.12
I tried changing the rights of /usr/share/graphite-web/graphite.wsgi
and /opt/graphite/conf/graphite.wsgi
but it didn't solve the problem.
My error log:
[Thu Jan 18 14:53:17.260272 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] mod_wsgi (pid=16527): Target WSGI script '/usr/share/graphite-web/graphite.wsgi' cannot be loaded as Python module.
[Thu Jan 18 14:53:17.260431 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] mod_wsgi (pid=16527): Exception occurred processing WSGI script '/usr/share/graphite-web/graphite.wsgi'.
[Thu Jan 18 14:53:17.260470 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] Traceback (most recent call last):
[Thu Jan 18 14:53:17.260507 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/share/graphite-web/graphite.wsgi", line 16, in <module>
[Thu Jan 18 14:53:17.260552 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] application = get_wsgi_application()
[Thu Jan 18 14:53:17.260564 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Jan 18 14:53:17.260586 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] django.setup(set_prefix=False)
[Thu Jan 18 14:53:17.260597 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
[Thu Jan 18 14:53:17.260630 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] apps.populate(settings.INSTALLED_APPS)
[Thu Jan 18 14:53:17.260651 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 78, in populate
[Thu Jan 18 14:53:17.260670 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] raise RuntimeError("populate() isn't reentrant")
[Thu Jan 18 14:53:17.260695 2018] [:error] [pid 16527] [remote 203.80.55.88:18829] RuntimeError: populate() isn't reentrant
This is the content of /usr/share/graphite-web/graphite.wsgi
(which is the same than my /opt/graphite/webapp/wsgi.py
)
import os
import sys
sys.path.append('/opt/graphite/webapp')
try:
from importlib import import_module
except ImportError:
from django.utils.importlib import import_module
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphite.settings') # noqa
from django.conf import settings
from django.core.wsgi import get_wsgi_application
from graphite.logger import log
application = get_wsgi_application()
try:
import whitenoise
except ImportError:
whitenoise = False
else:
# WhiteNoise < 2.0.1 does not support Python 2.6
if sys.version_info[:2] < (2, 7):
whitenoise_version = tuple(map(
int, getattr(whitenoise, '__version__', '0').split('.')))
if whitenoise_version < (2, 0, 1):
whitenoise = False
if whitenoise:
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(application)
prefix = "/".join((settings.URL_PREFIX.strip('/'), 'static'))
for directory in settings.STATICFILES_DIRS:
application.add_files(directory, prefix=prefix)
for app_path in settings.INSTALLED_APPS:
module = import_module(app_path)
directory = os.path.join(os.path.dirname(module.__file__), 'static')
if os.path.isdir(directory):
application.add_files(directory, prefix=prefix)
# Initializing the search index can be very expensive. The import below
# ensures the index is preloaded before any requests are handed to the
# process.
log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
import graphite.metrics.search # noqa
I also have a file /opt/graphite/conf/graphite.wsgi:
import sys
sys.path.append('/opt/graphite/webapp')
from graphite.wsgi import application
I don't know much about wsgi and I don't understand these logs. Help needed... Thank you so much.