graphite-web in virtualenv on CentOS 6.5

Asked by Roman Vrublevskiy on 2016-07-18

Hello everyone.
I'm trying to install graphite 0.9.15 from sources on CentOS 6.5

What I have accomplished so far:
compiled and installed in /opt python2.7.12
created virtualenv in /opt/graphite
compiled and installed graphite components (whisper, carbon, graphite-web) in virtualenv
compiled mod_wsgi with python 2.7 and configure apache to use it

I really stuck on making graphite-web work under apache.
Apache throws this error in error.log
[Mon Jul 18 10:54:06 2016] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/4.5.3 Python/2.7.12 configured -- resuming normal operations
[Mon Jul 18 10:54:06 2016] [error] mod_wsgi (pid=17237): Target WSGI script '/opt/graphite/conf/graphite.wsgi' cannot be loaded as Python module.
[Mon Jul 18 10:54:06 2016] [error] mod_wsgi (pid=17237): Exception occurred processing WSGI script '/opt/graphite/conf/graphite.wsgi'.
[Mon Jul 18 10:54:06 2016] [error] Traceback (most recent call last):
[Mon Jul 18 10:54:06 2016] [error] File "/opt/graphite/conf/graphite.wsgi", line 32, in <module>
[Mon Jul 18 10:54:06 2016] [error] from whitenoise.django import DjangoWhiteNoise
[Mon Jul 18 10:54:06 2016] [error] File "/opt/graphite/lib/python2.7/site-packages/whitenoise/django.py", line 17, in <module>
[Mon Jul 18 10:54:06 2016] [error] from django.utils.six.moves.urllib.parse import urlparse
[Mon Jul 18 10:54:06 2016] [error] ImportError: No module named six.moves.urllib.parse

If I run graphite-web as django dev app using following commands, it works as expected:

source /opt/graphite/bin/activate; python /opt/graphite/webapp/graphite/manage.py runserver 192.168.33.15:8000

Corresponding part of apache config:
# WSGISocketPrefix /var/log/httpd
# WSGIPythonHome /opt/graphite
# WSGIPythonPath /opt/graphite:/opt/graphite/lib/python2.7/site-packages

WSGIDaemonProcess graphiteweb python-path=/opt/graphite:/opt/graphite/lib/python2.7/site-packages
WSGIProcessGroup graphiteweb
WSGIApplicationGroup %{GLOBAL}
WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphiteweb application-group=%{GLOBAL}
WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi

<VirtualHost *:80>
  # wsgi script and permissions to read it
  #WSGIDaemonProcess sampleapp python-path=/opt/graphite/webapp:/opt/graphite/lib/python2.7/site-packages
  #WSGIProcessGroup sampleapp
  # WSGISocketPrefix /opt/graphite/storage
  WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi
  <Directory /opt/graphite/conf>
    # Require all granted
  </Directory>
</VirtualHost>

I tried all commented options and numerous others and didn't succeed.
I tried to add following in graphite.wsgi as specified in official documentation:
import site
site.addsitedir('/opt/graphite/lib/python2.6/site-packages')
It didn't work out as well.

You can get my environment as following:
git clone https://github.com/roman8422/graphite_centos65
cd graphite_centos65
vagrant up

Any help is really appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
Roman Vrublevskiy
Solved:
2016-07-18
Last query:
2016-07-18
Last reply:
Roman Vrublevskiy (roman8422) said : #1

Uninstall whitenoise python module solved the problem.
pip uninstall -y whitenoise