Graphiteをインストールする手順メモ
先に言うと、失敗してます。
python3で試してます。python2でやれば動くかも。
公式インストール手順(pip)
# MEMO:: 公式では'python-devel'となっているけど、
# それだと無いと怒られるのでpython3と指定
$ sudo yum install python3-devel cairo-devel libffi-devel
python3をデフォルトに指定する
$ sudo alternatives --config python
There are 2 programs which provide 'python'.
Selection Command
-----------------------------------------------
*+ 1 /usr/libexec/no-python
2 /usr/bin/python3
Enter to keep the current selection[+], or type selection number: 2
確認
$ python --version
Python 3.6.8
$ su -
# export PYTHONPATH="/opt/graphite/lib/:/opt/graphite/webapp/"
# pip3 install --no-binary=:all: https://github.com/graphite-project/whisper/tarball/master
# pip3 install --no-binary=:all: https://github.com/graphite-project/carbon/tarball/master
# pip3 install --no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/master
DBセットアップ
ここでコケる。
# PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py migrate --settings=graphite.settings --run-syncdb
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 366, in execute
self.check()
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 395, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 63, in _run_checks
issues = run_checks(tags=[Tags.database])
File "/usr/local/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python3.6/site-packages/django/core/checks/database.py", line 9, in check_database_backends
for conn in connections.all():
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 222, in all
return [self[alias] for alias in self]
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 219, in __iter__
return iter(self.databases)
File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 153, in databases
self._databases = settings.DATABASES
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'graphite'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 341, in run_from_argv
connections.close_all()
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 225, in close_all
for alias in self:
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 219, in __iter__
return iter(self.databases)
File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 153, in databases
self._databases = settings.DATABASES
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 76, in __getattr__
self._setup(name)
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 63, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 142, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'graphite'
たしかに graphite
がないので、pipでインストールしようと試みる
# pip3 install graphite
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting graphite
Downloading https://files.pythonhosted.org/packages/01/06/673ae9cf9d2f1863c89e938ae9425e4fb2db08899d83f52649c42cacf460/graphite-0.71.tar.gz (56kB)
100% |████████████████████████████████| 61kB 230kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-684uhvc4/graphite/setup.py", line 23
print "EZ_setup"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("EZ_setup")?
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-684uhvc4/graphite/
この print
の書き方はpython2なのでそりゃしくじると。
graphiteを入れるにはpip2である必要がありそう。