ImportError: cannot import name daemonize

Asked by Ben Hsu on 2013-11-11

I am trying to install Graphite on Cent 6. When I try to start carbon, I get an ImportError on the word "daemonize"

Here are the steps I've taken

# set up virtualenv
    1 virtualenv /opt/graphite
    2 source /opt/graphite/bin/activate

# gcc is needed to install some binary packages
    4 yum install gcc

# pip install as per instructions
    5 pip install whisper carbon graphite-web

#try to start
   11 /opt/graphite/bin/carbon-cache.py start

and I get this error:

Traceback (most recent call last):
  File "/opt/graphite/bin/carbon-cache.py", line 28, in <module>
    from carbon.util import run_twistd_plugin
  File "/opt/graphite/lib/carbon/util.py", line 21, in <module>
    from twisted.scripts._twistd_unix import daemonize
ImportError: cannot import name daemonize

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
Manuel Guerrero
Solved:
2013-11-15
Last query:
2013-11-15
Last reply:
2013-11-12
Kevin Williams (kevwil) said : #1

We are having the same issue today. We are using Ubuntu 12.04 LTS Server in EC2.

Ben Hsu (benhsu) said : #3

the Twisted forum says they wont fix this. Is there a patch I can apply to Carbon?

Best Manuel Guerrero (manolo-r) said : #4

Try this. In /opt/graphite/lib/carbon/util.py :

------------Original -----------------------------------
from time import sleep, time
from twisted.python.util import initgroups
from twisted.scripts.twistd import runApp
from twisted.scripts._twistd_unix import daemonize

daemonize = daemonize # Backwards compatibility
---------------------------------------------------------
Change to:
------------Changed -----------------------------------
from time import sleep, time
from twisted.python.util import initgroups
from twisted.scripts.twistd import runApp
from twisted.scripts._twistd_unix import daemonize

# daemonize = daemonize # Backwards compatibility
---------------------------------------------------------

Kevin Williams (kevwil) said : #5

The breaking change in Twisted came in 13.2.0 released on 11/8. I tried going back to Twisted 13.1.0 and Carbon works OK that way.

Ben Hsu (benhsu) said : #6

Thanks Manuel Guerrero, that solved my question.

Swapnil (swapsjd) said : #7

Hi, How do I install Twisted 13.1.0 on ubuntu 12.04 ?