Django "compilemessages" error: Can't find msgfmt (GNU gettext) on Ubuntu VPS

I am trying to compile translation messages in my Django project by running the following command:

python manage.py compilemessages

However, I get this error:

CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.

So then I tried installing gettext.

sudo apt update && sudo apt install gettext -y

After installation, I still get the same error when running python manage.py compilemessages.

Checked if msgfmt is installed by msgfmt --version but it says: command not found

OS is Ubuntu and Django version is 4.2.5.

How can I resolve this issue and make Django recognize msgfmt? Any help would be appreciated!

I've got the point.

After deactivating the virtual environment, I tried installing gettext.

Now it is okay.

Вернуться на верх