Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install graphite +statsd ....getting error unknown carbon-cache

I am following these instructions(https://www.digitalocean.com/community/tutorials/how-to-install-and-use-graphite-on-an-ubuntu-14-04-server) to install statsd and graphite, but am running into below stated problem. Seems like this is not a graphite issue but python issue. Does anybody know how to resolve this?

~/build > sudo service carbon-cache start
 * Starting Graphite backend daemon carbon-cache
Traceback (most recent call last):
  File "/usr/bin/carbon-cache", line 32, in <module>
    run_twistd_plugin(__file__)
  File "/usr/lib/python2.7/dist-packages/carbon/util.py", line 90, in run_twistd_plugin
    config.parseOptions(twistd_options)
  File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 604, in parseOptions
    usage.Options.parseOptions(self, options)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/usage.py", line 269, in parseOptions
    raise UsageError("Unknown command: %s" % sub)
twisted.python.usage.UsageError: Unknown command: carbon-cache
like image 847
user2574872 Avatar asked Jan 14 '15 19:01

user2574872


2 Answers

for some reason twisted was messing up something with graphite. read on the internet that manually removng twisted solves the problem. Tried it and it works now

just did

 sudo rm -rf /usr/local/lib/python2.7/dist-packages/twiste*
like image 156
user2574872 Avatar answered Oct 04 '22 21:10

user2574872


I was following the same instructions and encountered the same problem.

Moving or removing the /usr/local/lib/python2.7/dist-packages/twisted directory also resolved the issue for me.

You can use for example the following command to change the name of the problematic directory:

mv /usr/local/lib/python2.7/dist-packages/twisted /usr/local/lib/python2.7/dist-packages/twisted2

Then use sudo service carbon-cache start again

Background

I had the same issue on my Ubuntu 14.04 machine. Some investigation indicates that there are two virtually identical areas for twisted plugins on my machine.

/usr/local/lib/python2.7/dist-packages/twisted

and

/usr/lib/python2.7/dist-packages/twisted

I am not sure where these two areas originate from. Perhaps one comes with the distro and the other is created through a manual pip install twisted that I may have done at one time. I suspect that the /usr/local/lib/python2.7/dist-packages/ area gets populated with content when I install packages using pip. So this problem my eventually be attributed to users (e.g. me) installing twisted via pip and via the apt package system.

In any case, a diff through these areas showed that the carbon related files were installed into the /usr/lib/python2.7/dist-packages/ area. dpkg -L graphite-carbon also indicates that the package files go into the /usr/lib/python2.7/dist-packages/ area.

However, when the carbon start script is run is appears that /usr/local/lib/python2.7/dist-packages/twisted/plugins area is used leading to the plugin not being found.

I assume that this issue is related to the modules search path. As can be seen below the /usr/local/lib/python2.7/dist-packages/ comes before the /usr/lib/python2.7/dist-packages/ in my default path.

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 
 '/usr/lib/python2.7', 
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk', 
 '/usr/lib/python2.7/lib-old', 
 '/usr/lib/python2.7/lib-dynload', 
 '/usr/local/lib/python2.7/dist-packages', 
 '/usr/lib/python2.7/dist-packages', 
 '/usr/lib/python2.7/dist-packages/PILcompat', 
 '/usr/lib/python2.7/dist-packages/gtk-2.0', 
 '/usr/lib/pymodules/python2.7', 
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
>>> 
like image 45
claws Avatar answered Oct 04 '22 21:10

claws