Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: cannot import name generic #2417

Closed
fuzzball5000 opened this issue Jan 25, 2019 · 3 comments
Closed

ImportError: cannot import name generic #2417

fuzzball5000 opened this issue Jan 25, 2019 · 3 comments
Labels

Comments

@fuzzball5000
Copy link

Hello

Installing Graphite on RHEL7 using the EPEL 7.11 graphite-web package.

Installing Django 1.7 into /usr/share/graphite/webapp I'm able to perform django-admin syncdb as below:

PYTHONPATH=/usr/share/graphite/webapp django-admin syncdb --settings=graphite.settings

But, at run time, the application is logging the below to graphite-web-error.log:

[Thu Jan 24 23:44:43.318678 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     application = get_wsgi_application()
[Thu Jan 24 23:44:43.318699 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
[Thu Jan 24 23:44:43.318777 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     django.setup(set_prefix=False)
[Thu Jan 24 23:44:43.318796 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
[Thu Jan 24 23:44:43.318871 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     apps.populate(settings.INSTALLED_APPS)
[Thu Jan 24 23:44:43.318893 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
[Thu Jan 24 23:44:43.319068 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     app_config.import_models()
[Thu Jan 24 23:44:43.319113 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
[Thu Jan 24 23:44:43.319273 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     self.models_module = import_module(models_module_name)
[Thu Jan 24 23:44:43.319295 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
[Thu Jan 24 23:44:43.319377 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     __import__(name)
[Thu Jan 24 23:44:43.319396 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/graphite/events/models.py", line 6, in <module>
[Thu Jan 24 23:44:43.319467 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     from tagging.managers import ModelTaggedItemManager
[Thu Jan 24 23:44:43.319486 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/tagging/managers.py", line 8, in <module>
[Thu Jan 24 23:44:43.319570 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     from tagging.models import Tag, TaggedItem
[Thu Jan 24 23:44:43.319595 2019] [:error] [pid 16932] [client 10.32.32.121:64234]   File "/usr/lib/python2.7/site-packages/tagging/models.py", line 10, in <module>
[Thu Jan 24 23:44:43.319776 2019] [:error] [pid 16932] [client 10.32.32.121:64234]     from django.contrib.contenttypes import generic
[Thu Jan 24 23:44:43.319815 2019] [:error] [pid 16932] [client 10.32.32.121:64234] ImportError: cannot import name generic```
@deniszh
Copy link
Member

deniszh commented Jan 25, 2019

Hello @fuzzball5000,
Unfortunately, Django 1.7 is not supported. Graphite 1.0.x and newer require Django >=1.8, Graphite 0.9.x supports only Django 1.4

@fuzzball5000
Copy link
Author

Thanks @deniszh, although I tried 1.8 with similar results, syncdb works when forced to use a PYTHONPATH which has an older Django installed. I think we've narrowed the issue down to graphite picking up a newer Django from somewhere in the path - will attempt to run it up in a virtualenv.

@piotr1212
Copy link
Member

Probably path issue, hope we can improve it with #2409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants