django-suit icon indicating copy to clipboard operation
django-suit copied to clipboard

Upgrading to Django 1.8 causes "cannot import VERSION" errror

Open davidstockwell opened this issue 9 years ago • 15 comments

Hi,

Firstly, I apologise because I'm not sure what the cause of this error was, or if it relates to the source of django-suit but when I upgraded to Django 1.8, I got an error when loading the admin site. It complained that it couldn't import VERSION in config.py:

from . import VERSION

When I removed that import statement and hard-coded the VERSION like this:

def default_config(): return { 'VERSION': "0.2.12",

The error corrected itself.

More weirdly, though, when I reverted my changes to config.py it continued to load the admin page with no errors.

The only other change I made was to add a "print" statement into init.py just under VERSION="0.2.12".

Could it be something silly like a missing carriage return after that line which Python then rejects?

davidstockwell avatar Apr 17 '15 08:04 davidstockwell

Hard to say. Maybe some weird python byte cache issue too. I just tried, upgraded old project to Django and didn't see such an error. Anyways i will close it for now. If anyone spots the same problem and can give some more details please feel free to reopen this issue.

darklow avatar Apr 22 '15 07:04 darklow

I have the same problem, even tried removing all pyc files.

'suit_tags' is not a valid tag library: ImportError raised loading suit.templatetags.suit_tags: cannot import name VERSION

Here is my requirements file:

django==1.8.1
django-suit==0.3a1
suit==2.0.2

JREAM avatar May 03 '15 06:05 JREAM

Same for me, here is some more context:

<ipython-input-7-677842075894> in <module>()
----> 1 from suit.templatetags import suit_tags

/home/titus/envs/dev2/lib/python2.7/site-packages/suit/templatetags/suit_tags.py in <module>()
      6 from django.template.defaulttags import NowNode
      7 from django.utils.safestring import mark_safe
----> 8 from suit.config import get_config
      9 from suit import utils
     10 

/home/titus/envs/dev2/lib/python2.7/site-packages/suit/config.py in <module>()
      1 from django.contrib.admin import ModelAdmin
      2 from django.conf import settings
----> 3 from . import VERSION
      4 
      5 

ImportError: cannot import name VERSION

tsoporan avatar May 03 '15 21:05 tsoporan

pip uninstall suit if you have suit installed as well. That was my issue when I ran into the 'suit_tags' is not a valid tag library: ImportError raised loading suit.templatetags.suit_tags: cannot import name VERSION error. suit overwrites config.py, at the very least, which removes the VERSION information that django-suit is looking for.

ralacher avatar Oct 21 '15 01:10 ralacher

I am getting the same error and if I unintsalled suit I get error "ImportError: No module named suit" . Did anyone resolved it ?

bhupendrabjain avatar Apr 15 '16 21:04 bhupendrabjain

@bhupendrabjain Please post full error stacktrace to https://dpaste.de/ and share it here

darklow avatar Apr 15 '16 22:04 darklow

Unhandled exception in thread started by <function wrapper at 0x105b1c140> Traceback (most recent call last): File "/Users/bond/miniconda/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(_args, *_kwargs) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/Users/bond/miniconda/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception six.reraise(__exception) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(_args, **kwargs) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/init.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate app_config.ready() File "/Users/bond/miniconda/lib/python2.7/site-packages/cms/apps.py", line 12, in ready setup() File "/Users/bond/miniconda/lib/python2.7/site-packages/cms/utils/setup.py", line 65, in setup plugin_pool.validate_templates() File "/Users/bond/miniconda/lib/python2.7/site-packages/cms/plugin_pool.py", line 73, in validate_templates loader.get_template(template) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/loader.py", line 26, in get_template engines = _engine_list(using) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/loader.py", line 143, in _engine_list return engines.all() if using is None else [engines[using]] File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/utils.py", line 110, in all return [self[alias] for alias in self] File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/utils.py", line 101, in getitem engine = engine_cls(params) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 31, in init options['libraries'] = self.get_templatetag_libraries(libraries) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 49, in get_templatetag_libraries libraries = get_installed_libraries() File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 131, in get_installed_libraries for name in get_package_libraries(pkg): File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 148, in get_package_libraries "trying to load '%s': %s" % (entry[1], e) django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'suit.templatetags.suit_compat': cannot import name Library Reply to this snippet →

Unhandled exception in thread started by <function wrapper at 0x105b1c140> Traceback (most recent call last): File "/Users/bond/miniconda/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(_args, *_kwargs) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/Users/bond/miniconda/lib/python2.7/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception six.reraise(__exception) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper fn(_args, **kwargs) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/init.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate app_config.ready() File "/Users/bond/miniconda/lib/python2.7/site-packages/cms/apps.py", line 12, in ready setup() File "/Users/bond/miniconda/lib/python2.7/site-packages/cms/utils/setup.py", line 65, in setup plugin_pool.validate_templates() File "/Users/bond/miniconda/lib/python2.7/site-packages/cms/plugin_pool.py", line 73, in validate_templates loader.get_template(template) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/loader.py", line 26, in get_template engines = _engine_list(using) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/loader.py", line 143, in _engine_list return engines.all() if using is None else [engines[using]] File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/utils.py", line 110, in all return [self[alias] for alias in self] File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/utils.py", line 101, in getitem engine = engine_cls(params) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 31, in init options['libraries'] = self.get_templatetag_libraries(libraries) File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 49, in get_templatetag_libraries libraries = get_installed_libraries() File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 131, in get_installed_libraries for name in get_package_libraries(pkg): File "/Users/bond/miniconda/lib/python2.7/site-packages/django/template/backends/django.py", line 148, in get_package_libraries "trying to load '%s': %s" % (entry[1], e) django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'suit.templatetags.suit_compat': cannot import name Library

fakira avatar Jul 07 '16 05:07 fakira

@fakira I am willing to help and solve this issue, but there is no way I can replicate this error. Maybe somebody can set up sample project and push code to github repository along with requirements.txt file. Thank you.

darklow avatar Jul 07 '16 08:07 darklow

It's a bit late, but I've just hit the same issue. The solution provided by @rlacherksu worked, it just should be pip uninstall django-suit not pip uninstall suit (but I guess everyone should handle this typo by themselves).

vintage avatar Sep 01 '16 11:09 vintage

I had a problem like this, it was fixed when I upgraded from 0.2.12 to 0.2.23.

alexmojaki avatar Dec 12 '16 12:12 alexmojaki

pip install django-suit helps to solve my error with Django 2.0 as i had not installed it.

SatinderpalSingh avatar Dec 25 '18 07:12 SatinderpalSingh

hello, i got this error when trying to runserver after installing django suit and requirement in the setting.py

django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'suit.templatetags.suit_menu': No module named 'django.core.urlresolvers'

Hudeh avatar Sep 16 '19 09:09 Hudeh

Hi,

Firstly, I apologise because I'm not sure what the cause of this error was, or if it relates to the source of django-suit but when I upgraded to Django 1.8, I got an error when loading the admin site. It complained that it couldn't import VERSION in config.py:

from . import VERSION

When I removed that import statement and hard-coded the VERSION like this:

def default_config(): return { 'VERSION': "0.2.12",

The error corrected itself.

More weirdly, though, when I reverted my changes to config.py it continued to load the admin page with no errors.

The only other change I made was to add a "print" statement into init.py just under VERSION="0.2.12".

Could it be something silly like a missing carriage return after that line which Python then rejects?

harshbarotb avatar Jun 03 '20 03:06 harshbarotb

hii i having same error can you plz help me

harshbarotb avatar Jun 03 '20 03:06 harshbarotb

You've maybe installed wrong package suit which writes package files into the same folder. Please uninstall it: pip uninstall suit uninstall django-suit: pip uninstall django-suit and install django-suit again pip install django-suit

wizzzet avatar Sep 01 '20 08:09 wizzzet