Document installation for OSX (cannot import name constants)
See original GitHub issueI am trying to install Graphite. I am stuck upon cairo installation. I came across “http://stackoverflow.com/questions/11491268/install-pycairo-in-virtualenv”. I have installed cairocffi in my virtual environment.
My environment is: “OS X: 10.8.5 Python: 2.7.2 Virtual Env: pip list cairocffi (0.5.1) ceres (0.10.0) cffi (0.8.1) Django (1.5.5) django-tagging (0.3.1) pip (1.5) pycparser (2.10) setuptools (2.0.2) Twisted (11.1.0) txAMQP (0.6.2) whisper (0.9.12) wsgiref (0.1.2) zope.interface (4.0.5)”
Cairo: I have installed cairo using macports. “cairo @1.12.16_2+x11 (active)”
I started graphite with following sequence of commands:
- source /opt/graphite/bin/activate
- sudo /opt/graphite/bin/carbon-cache.py start
- sudo ./bin/run-graphite-devel-server.py /opt/graphite
http://0.0.0.0:8080/ is displaying Graphite home page. But http://0.0.0.0:8080/render produces following traceback:
Traceback (most recent call last):
File "/opt/graphite/lib/python2.7/site-packages/django/core/handlers/base.py", line 103, in get_response
resolver_match = resolver.resolve(request.path_info)
File "/opt/graphite/lib/python2.7/site-packages/django/core/urlresolvers.py", line 321, in resolve
sub_match = pattern.resolve(new_path)
File "/opt/graphite/lib/python2.7/site-packages/django/core/urlresolvers.py", line 321, in resolve
sub_match = pattern.resolve(new_path)
File "/opt/graphite/lib/python2.7/site-packages/django/core/urlresolvers.py", line 223, in resolve
return ResolverMatch(self.callback, args, kwargs, self.name)
File "/opt/graphite/lib/python2.7/site-packages/django/core/urlresolvers.py", line 230, in callback
self._callback = get_callable(self._callback_str)
File "/opt/graphite/lib/python2.7/site-packages/django/utils/functional.py", line 31, in wrapper
result = func(*args)
File "/opt/graphite/lib/python2.7/site-packages/django/core/urlresolvers.py", line 97, in get_callable
mod = import_module(mod_name)
File "/opt/graphite/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/opt/graphite/webapp/graphite/render/views.py", line 36, in <module>
from graphite.render.evaluator import evaluateTarget
File "/opt/graphite/webapp/graphite/render/evaluator.py", line 47, in <module>
from graphite.render.functions import SeriesFunctions
File "/opt/graphite/webapp/graphite/render/functions.py", line 33, in <module>
from graphite.render.glyph import format_units
File "/opt/graphite/webapp/graphite/render/glyph.py", line 15, in <module>
import cairocffi as cairo
File "/opt/graphite/lib/python2.7/site-packages/cairocffi/__init__.py", line 16, in <module>
from . import constants
ImportError: cannot import name constants
Issue Analytics
- State:
- Created 10 years ago
- Comments:39 (15 by maintainers)
Top Results From Across the Web
ImportError: cannot import name constants - python
ImportError: cannot import name constants · It looks like you have two versions installed. Try starting over. · DON'T copy any Python bundle...
Read more >Document installation for OSX (cannot import name constants)
I am trying to install Graphite. I am stuck upon cairo installation. I came across "http://stackoverflow.com/questions/11491268/install-pycairo-in-virtualenv".
Read more >cannot import name 'constants' from 'zmq.backend.cython'
Coding example for the question Fresh Anaconda install gives "ImportError: cannot import name 'constants' from 'zmq.backend.cython'"
Read more >ImportError: cannot import name 'constants' - Google Groups
File "/root/v2.41/external_libs/pyzmq-14.5.0/python3/intel/ucs4/64bit/zmq/backend/cython/__init__.py", line 6, in <module>. from . import (constants, error, ...
Read more >How to Fix : “ImportError: Cannot import name X” in Python
Commonly, such an issue occurs because of a faulty installation or an invalid path, which will usually raise a ModuleNotFoundError in Python 3.6...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t know why, but
apt-get install python-cairo-dev
fixed my issue (same as OP)Thanks for the answer all above, I met this problem yesterday. By reading your answers, it solved by "brew install cairo"finnally lol