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

Problem after installing 0.16.2 #8155

Open
1 of 7 tasks
tnemrap opened this issue Sep 20, 2024 · 8 comments
Open
1 of 7 tasks

Problem after installing 0.16.2 #8155

tnemrap opened this issue Sep 20, 2024 · 8 comments
Labels
bug Identifies a bug which needs to be addressed setup Relates to the InvenTree setup / installation process
Milestone

Comments

@tnemrap
Copy link

tnemrap commented Sep 20, 2024

Deployment Method

  • Installer
  • Docker Development
  • Docker Production
  • Bare metal Development
  • Bare metal Production
  • Digital Ocean image
  • Other (please provide a link Steps to Reproduce

Describe the problem*

After update to 0.16.2 i get
OSError: No translation files found for default language en-us.

Steps to Reproduce

I just run inventree run cli update

Relevant log output

Installing plugin packages from '/etc/inventree/plugins.txt'
Python version 3.11.2 - /opt/inventree/env/bin/python3
Traceback (most recent call last):
File "/opt/inventree/src/backend/InvenTree/manage.py", line 24, in
main()
File "/opt/inventree/src/backend/InvenTree/manage.py", line 20, in main
execute_from_command_line(sys.argv)
File "/opt/inventree/env/lib/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/inventree/env/lib/python3.11/site-packages/django/core/management/init.py", line 416, in execute
django.setup()
File "/opt/inventree/env/lib/python3.11/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/inventree/env/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/opt/inventree/env/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/opt/inventree/src/backend/InvenTree/build/models.py", line 9, in
from django.contrib.auth.models import User
File "/opt/inventree/env/lib/python3.11/site-packages/django/contrib/auth/models.py", line 98, in
class Group(models.Model):
File "/opt/inventree/env/lib/python3.11/site-packages/django/db/models/base.py", line 194, in new
new_class.add_to_class(obj_name, obj)
File "/opt/inventree/env/lib/python3.11/site-packages/django/db/models/base.py", line 371, in add_to_class
value.contribute_to_class(cls, name)
File "/opt/inventree/env/lib/python3.11/site-packages/django/db/models/fields/related.py", line 1910, in contribute_to_class
self.remote_field.through = create_many_to_many_intermediary_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/db/models/fields/related.py", line 1269, in create_many_to_many_intermediary_model
"verbose_name": _("%(from)s-%(to)s relationship")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/utils/functional.py", line 191, in mod
return str(self) % rhs
^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/utils/functional.py", line 155, in __text_cast
return func(*self.__args, **self.__kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/utils/translation/init.py", line 95, in gettext
return _trans.gettext(message)
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/utils/translation/trans_real.py", line 380, in gettext
_default = _default or translation(settings.LANGUAGE_CODE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/utils/translation/trans_real.py", line 293, in translation
_translations[language] = DjangoTranslation(language)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/inventree/env/lib/python3.11/site-packages/django/utils/translation/trans_real.py", line 179, in init
raise OSError(
OSError: No translation files found for default language en-us.

@tnemrap tnemrap added question This is a question setup Relates to the InvenTree setup / installation process triage:not-checked Item was not checked by the core team labels Sep 20, 2024
@czkapitan2
Copy link

Hi - confirm that - absolutely same logs. My test env is based on packager.io - so I trried to update 0.16.3 through packager.io , but it still try to install 0.16.2 .
Pavel

@StormTrooper
Copy link

I'm having the same issue. Upgraded from 0.16.1 to 0.16.3 and inventree no longer starts up. Tried downgrading back to 0.16.1 but that didn't fix it.
I should really start taking snapshots before these upgrades :(

Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     "verbose_name": _("%(from)s-%(to)s relationship")
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:   File "/opt/inventree/env/lib/python3.9/site-packages/django/utils/functional.py", line 191, in __mod__
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     return str(self) % rhs
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:   File "/opt/inventree/env/lib/python3.9/site-packages/django/utils/functional.py", line 155, in __text_cast
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     return func(*self.__args, **self.__kw)
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:   File "/opt/inventree/env/lib/python3.9/site-packages/django/utils/translation/__init__.py", line 95, in gettext
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     return _trans.gettext(message)
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:   File "/opt/inventree/env/lib/python3.9/site-packages/django/utils/translation/trans_real.py", line 380, in gettext
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     _default = _default or translation(settings.LANGUAGE_CODE)
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:   File "/opt/inventree/env/lib/python3.9/site-packages/django/utils/translation/trans_real.py", line 293, in translation
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     _translations[language] = DjangoTranslation(language)
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:   File "/opt/inventree/env/lib/python3.9/site-packages/django/utils/translation/trans_real.py", line 179, in __init__
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]:     raise OSError(
Sep 22 10:21:44 inventree-server inventree-web-1.service[445283]: OSError: No translation files found for default language en-us.

@StormTrooper
Copy link

StormTrooper commented Sep 22, 2024

I found the issue - looks like all the language files are missing.
For example under
opt/inventree/env/lib/python3.9/site-packages/rest_framework/locale/en_US/LC_MESSAGES
The folder is empty, this is the same for every language.

I checked on a older backup I had and the django.mo file is missing. I copied this file for just the en_US language and I'm now able to start inventree up and it's again working. (Other languages are all still broken)

Old test server:

root@inventree-server:/opt/inventree/env/lib/python3.9/site-packages/rest_framework/locale# find -name django.mo | wc -l
59
root@inventree-server:/opt/inventree/env/lib/python3.9/site-packages/rest_framework/locale/en_US/LC_MESSAGES# ls -la
total 12
drwxrwxr-x 2 inventree inventree 4096 Sep 22 11:11 .
drwxrwxr-x 3 inventree inventree 4096 May 20 11:33 ..
-rw-rw-r-- 1 inventree inventree  337 Sep 22 11:11 django.mo

Upgraded to 0.16.3 (With my fix):

root@inventree-server:/opt/inventree/env/lib/python3.9/site-packages/rest_framework/locale# find -name django.mo | wc -l
1

0.16.3 Prior to my fix:

root@inventree-server:/opt/inventree/env/lib/python3.9/site-packages/rest_framework/locale/en_US/LC_MESSAGES# ls -la
total 8
drwxrwxr-x 2 inventree inventree 4096 Sep 22 10:10 .
drwxrwxr-x 3 inventree inventree 4096 May 20 11:33 ..

@SchrodingersGat
Copy link
Member

  • What prompted you to look at the rest_framework library directory?
  • Is it just for the rest_framework library that translation files are missing?
  • Are the InvenTree files missing too?

@StormTrooper
Copy link

It was more by luck. I know nothing about rest_framework but saw the error was about python language files missing so started search for folders that stored the locales and came across the missing files.

I've checked and don't see any other locales missing from other subdirectories.
Also don't see any other files missing.

@SchrodingersGat
Copy link
Member

@matmair @wolflu05 this has now come up twice. No idea what might be going on here.. Any thoughts?

@SchrodingersGat SchrodingersGat added bug Identifies a bug which needs to be addressed and removed question This is a question triage:not-checked Item was not checked by the core team labels Oct 9, 2024
@SchrodingersGat SchrodingersGat added this to the 0.17.0 milestone Oct 9, 2024
@matmair
Copy link
Member

matmair commented Oct 9, 2024

No idea, the shipped stuff has not really changed. On the road without my normal dev setup right now so hard to debug

@ShafiqSadat
Copy link

Same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies a bug which needs to be addressed setup Relates to the InvenTree setup / installation process
Projects
None yet
Development

No branches or pull requests

6 participants