bash 无法启动 Carbon - 12.04 - Python 错误 - 导入错误:无法导入名称守护进程
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19894708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can't Start Carbon - 12.04 - Python Error - ImportError: cannot import name daemonize
提问by Shane Baldacchino
I am really hoping someone can help me as I have spent at-least 15 hours trying to fix this problem. I have been given a task by a potential employer and my solution is to use graphite/carbon/collectd. I am trying to run and install carbon / graphite 0.9.12 but I simply can't get carbon to start. Every time I try and start carbon I end up with the following error. I am using a bash script to install to keep everything consistent.
我真的希望有人能帮助我,因为我至少花了 15 个小时试图解决这个问题。潜在雇主给了我一项任务,我的解决方案是使用石墨/碳/收集。我正在尝试运行并安装碳/石墨 0.9.12,但我根本无法启动碳。每次我尝试启动 carbon 时,我都会遇到以下错误。我正在使用 bash 脚本进行安装以保持所有内容一致。
I don't really know python at all so would appreciate any help you can provide.
我根本不知道python,所以很感激你能提供的任何帮助。
/etc/rc0.d/K20carbon-cache -> ../init.d/carbon-cache
/etc/rc1.d/K20carbon-cache -> ../init.d/carbon-cache
/etc/rc6.d/K20carbon-cache -> ../init.d/carbon-cache
/etc/rc2.d/S20carbon-cache -> ../init.d/carbon-cache
/etc/rc3.d/S20carbon-cache -> ../init.d/carbon-cache
/etc/rc4.d/S20carbon-cache -> ../init.d/carbon-cache
/etc/rc5.d/S20carbon-cache -> ../init.d/carbon-cache
Traceback (most recent call last):
File "/opt/graphite/bin/carbon-cache.py",
line 28, in from carbon.util import run_twistd_plugin
File "/opt/graphite/lib/carbon/util.py",
line 21, in from twisted.scripts._twistd_unix import daemonize
ImportError: cannot import name daemonize
Thanks
谢谢
Shane
沙恩
回答by user120027
pip install 'Twisted<12.0'
As you can see in the requirements.txt, the newer version of Twisted does not seems to play well with it
正如您在requirements.txt 中看到的,较新版本的 Twisted 似乎不能很好地使用它
回答by Paul Zielinski
pip install daemonize
then I opened /opt/graphite/lib/carbon/util.py and changed
然后我打开 /opt/graphite/lib/carbon/util.py 并更改
from twisted.scripts._twistd_unix import daemonize
to
到
import daemonize
回答by annelorayne
I tried with pip install Twisted==11.1.0
but not got it downgrade my Twisted version. So, i renamed /usr/lib/python2.7/dist-packages/twisted/ to other name. After i install twisted pip install Twisted==11.1.0
and sudo ./bin/carbon-cache.py start
works.
我尝试过pip install Twisted==11.1.0
但没有降级我的 Twisted 版本。因此,我将 /usr/lib/python2.7/dist-packages/twisted/ 重命名为其他名称。在我安装扭曲pip install Twisted==11.1.0
并sudo ./bin/carbon-cache.py start
工作之后。
回答by John Sellens
You can likely remove refences to daemonize from lib/carbon/util.py
and then it seems to work with twisted 13.2.0
. See carbon github commit 1d0bdc5c6ac331fdcb6f6c0f897507fcf833f616
from Nov 18 2013
您可能会删除要守护的引用lib/carbon/util.py
,然后它似乎可以与twisted 13.2.0
. 请参阅commit 1d0bdc5c6ac331fdcb6f6c0f897507fcf833f616
2013 年 11 月 18 日的carbon github
https://github.com/graphite-project/carbon/commit/1d0bdc5c6ac331fdcb6f6c0f897507fcf833f616
https://github.com/graphite-project/carbon/commit/1d0bdc5c6ac331fdcb6f6c0f897507fcf833f616
回答by Tiago Lopo
Newest version of Twisted won't work.
最新版本的 Twisted 将无法使用。
Install version 13.0:
安装 13.0 版:
pip install http://twistedmatrix.com/Releases/Twisted/13.0/Twisted-13.0.0.tar.bz2