Many `manage.py` Commands not working in a kubernetes environment

Trying to run this command Throws an error:

ubuntu@tutor-gateway:~$ tutor k8s exec lms "./manage.py lms create_catalog_integrations --enabled --internal_api_url='' --service_username=lms_catalog_service_user"
kubectl exec -i -t --namespace openedx lms-6b68dc4fd-9578x -- sh -e -c ./manage.py lms create_catalog_integrations --enabled --internal_api_url='' --service_username=lms_catalog_service_user
2021-11-09 10:25:21,539 WARNING 123 [py.warnings] [user None] [ip None] warnings.py:109 - /openedx/venv/lib/python3.8/site-packages/newrelic/console.py:84: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly
  prototype = wrapper.__name__[3:] + ' ' + inspect.formatargspec(

2021-11-09 10:25:21,748 WARNING 123 [py.warnings] [user None] [ip None] warnings.py:109 - /openedx/edx-platform/lms/djangoapps/course_wiki/plugins/markdownedx/wiki_plugin.py:5: DeprecationWarning: 'etree' is deprecated. Use 'xml.etree.ElementTree' instead.
  from lms.djangoapps.course_wiki.plugins.markdownedx import mdx_mathjax, mdx_video

Traceback (most recent call last):
  File "./manage.py", line 120, in <module>
    startup.run()
  File "/openedx/edx-platform/lms/startup.py", line 20, in run
    django.setup()
  File "/openedx/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/openedx/venv/lib/python3.8/site-packages/django/apps/config.py", line 90, in create
    module = import_module(entry)
  File "/opt/pyenv/versions/3.8.6/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'debug_toolbar'
command terminated with exit code 1
Error: Command failed with status 1: kubectl exec -i -t --namespace openedx lms-6b68dc4fd-9578x -- sh -e -c ./manage.py lms create_catalog_integrations --enabled --internal_api_url='' --service_username=lms_catalog_service_user

Seems like a lot of debug(?) packages are not included in the default images? Should i build the -dev image and use that?

django-debug-toolbar and factory_boy had to be installed. Seems like they should be installed by default in the docker images.

1 Like