---
slug: "python-cannot-import-name-ugettext_lazy"
title: "If you see \"cannot import name 'ugettext_lazy'\" in Django, Django 4.0 might be installed"
description: "Here is the solution for resolving the ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' that occurs when running manage.py hoge in Django."
url: "https://www.ytyng.com/en/blog/python-cannot-import-name-ugettext_lazy"
publish_date: "2021-12-11T13:51:59Z"
created: "2021-12-11T13:51:59Z"
updated: "2026-02-26T16:12:29.285Z"
categories: ["Django"]
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20230812/d9700c13de58413bb4b51e84e03b47b8.png.webp?width=768"
has_video: false
has_music: false
video_urls: []
music_urls: []
lang: "en"
---

# If you see "cannot import name 'ugettext_lazy'" in Django, Django 4.0 might be installed

<p>When you run <code>manage.py hoge</code> in Django</p>
<pre>ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/usr/lib/python3.8/site-packages/django/utils/translation/__init__.py)</pre>
<p>If you encounter this error, it is possible that Django 4.0 is installed.</p>
<p></p>
<p>By the way, if you're installing dependencies with Pipenv in a Dockerfile, you can use the following commands:</p>
<pre><span>COPY </span>Pipfile <span>/</span>tmp<span>/</span>Pipfile<br /><span>COPY </span>Pipfile.lock <span>/</span>tmp<span>/</span>Pipfile.lock<br />...<br />RUN PIPENV_PIPFILE=/tmp/Pipfile pipenv install --system --ignore-pipfile --deploy</pre>
<p>By adding the <code>--ignore-pipfile</code> option, the installation behavior will be similar to <code>pipenv sync</code>, which installs from the <code>Pipfile.lock</code>.</p>
