Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.5K
Visualizações
ImportError : cannot import name 'ugettext_lazy'

I'm trying to install suit, I entered this command : pip install https://github.com/darklow/django-suit/tarball/v2 and wrote this code :

from suit.apps import DjangoSuitConfig
class SuitConfig(DjangoSuitConfig) :
    layout = 'horizontal'

And added it :

INSTALLED_APPS = [
    'products.apps.SuitConfig',
     .....]

But when I added this last code I had this error :

InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'suit.templatetags.suit_menu': cannot import name 'ugettext_lazy' from 'django.utils.translation' (C:\Users\hp\environments\env3\lib\site-packages\django\utils\translation_init_.py)

note : django 4.01

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I also got the same issue while using django-hitcount

views.py

from hitcount.views import HitCountDetailView

class PostDetailView(HitCountDetailView):
model = Post
template_name = 'blog/post.html'
slug_field = "slug"
count_hit = True

settings.py

INSTALLED_APPS = [
'hitcount',
 .....]

One answer is ugettext_lazy has been removed in Django 4.0 57. Please use gettext_lazy instead ""

from django.utils.translation import gettext_lazy as _

I put this line of code in the views.py, and got the same error.

over 4 years ago · Santiago Trujillo Relatório

0

Was just about to ask the version but the note (django 4.01) helped. 'ugettext_lazy' seems to be used by the app you are trying to use as well.

'ugettext_lazy' has been deprecated for django 3+ so you won’t be able to use that with a django version >= 3. https://code.djangoproject.com/ticket/30165

over 4 years ago · Santiago Trujillo Relatório

0

I strongly recommend to downgrade Django from "4.x.x" to "3.x.x" to solve your errors:

pip install django==3.x.x

Because Django 4.x.x is very new so some packages don't catch up with Django 4.x.x. So, if you keep using Django 4.x.x, you will get the same or similar errors in the near future then you will spend a lot of time to solve these errors because of Django 4.x.x.

Actually, I got the same or similar errors when using "django-graphql-jwt", "graphene-django" and so on. Then, for some packages, I could solve such errors but for some packages, I could solve but new other errors occurred then, I couldn't solve these new other errors.

Finally, I noticed I spent a lot of time to solve such errors because of Django 4.x.x. So again, I strongly recommend to downgrade Django from "4.x.x" to "3.x.x" to solve your errors:

pip install django==3.x.x
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda