Problem installing carbon: "cannot import name MetricCache "

Asked by D Zohrob

Hi,

I'm trying to install graphite on an Ubuntu 10.x box and am getting some strange errors. Besides issues configuring WSGI etc, I'm now running into:

./carbon-cache.py start
Traceback (most recent call last):
  File "./carbon-cache.py", line 118, in <module>
    from carbon.listeners import MetricLineReceiver, MetricPickleReceiver, CacheQueryHandler, startListener
  File "/opt/graphite/lib/carbon/listeners.py", line 5, in <module>
    from carbon.cache import MetricCache
  File "/opt/graphite/lib/carbon/cache.py", line 17, in <module>
    from carbon.instrumentation import increment
  File "/opt/graphite/lib/carbon/instrumentation.py", line 147, in <module>
    from carbon.cache import MetricCache
ImportError: cannot import name MetricCache

I'm not new to Linux or sysadmin but I *am* new to python -- I might be missing something but it appears that there's some sort of circular reference between carbon/instrumentation.py and carbon/cache.py.

Any ideas on how to resolve this?

Thanks,
dave

Question information

Language:
English Edit question
Status:
Solved
For:
Graphite Edit question
Assignee:
No assignee Edit question
Solved by:
chrismd
Solved:
Last query:
Last reply:
Revision history for this message
chrismd (chrismd) said :
#1

Which version are you using?

Revision history for this message
D Zohrob (akx-dave) said :
#2

I'm running python 2.6.5 on Ubuntu 10.04. I'm not familiar with Bazaar, but I followed the instructions from the tutorial this morning and used:

bzr branch lp:graphite

Was this the correct branch?

FWIW, I moved the import from line 17 of cache.py to the bottom of the file and it seems to have solved the problem. Not sure if a recent revision may have changed something -- I'm a noob, so hopefully I haven't wasted your time.

Revision history for this message
Best chrismd (chrismd) said :
#3

Thanks for letting me know, trunk happens to be broken today (I made a bad commit and ran out the door, sorry). I will fix it later tonight.

You're using the right branch, sorry for the breakage, give it a shot tomorrow and let me know if you have any issues.

Revision history for this message
Michael Hopkins (mhopkins-f) said :
#4

Was wondering if the changes for this fix were committed to the trunk. I ran an install just now and got the same MetricCache error

Revision history for this message
D Zohrob (akx-dave) said :
#5

Michael, I believe I moved this line in /opt/graphite/lib/carbon/cache.py

from carbon.instrumentation import increment

to the bottom of the file. HTH.

Revision history for this message
D Zohrob (akx-dave) said :
#6

Thanks chrismd, that solved my question.

Revision history for this message
Michael Hopkins (mhopkins-f) said :
#7

Thank you both, that works great.

Revision history for this message
chrismd (chrismd) said :
#8

Sorry no I only got some of the trunk issues fixed last night and this was not one of them. Thanks for pointing out the quick fix D Zohrob, I just applied that to trunk.