Install Maple: ImportError: cannot import name RemovedInDjango40Warning

Hello,
got Ubuntu 18.04.6 and Docker and Python 3
tried to install Maple by binary or pip, but got the same error:

Creating tutor_local_lms-job_run ... done
2021/12/24 11:19:23 Waiting for: tcp://mysql:3306
2021/12/24 11:19:23 Connected to tcp://mysql:3306
Loading settings lms.envs.tutor.production
Traceback (most recent call last):
  File "./manage.py", line 119, in <module>
    startup = importlib.import_module(edx_args.startup)
  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 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/lms/startup.py", line 10, in <module>
    settings.INSTALLED_APPS  # pylint: disable=pointless-statement
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  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 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/lms/envs/tutor/production.py", line 103, in <module>
    from django.utils.deprecation import RemovedInDjango40Warning, RemovedInDjango41Warning
ImportError: cannot import name 'RemovedInDjango40Warning' from 'django.utils.deprecation' (/openedx/venv/lib/python3.8/site-packages/django/utils/deprecation.py)
ERROR: 1
Error: Command failed with status 1: docker-compose -f /home/***/.local/share/tutor/env/local/docker-compose.yml -f /home/***/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/***/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Create oauth2 apps for CMS SSO
# https://github.com/edx/edx-platform/blob/master/docs/guides/studio_oauth.rst
./manage.py lms manage_user cms cms@openedx --unusable-password
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "http://studio.my.domain/complete/edx-oauth2/" \
  --client-id cms-sso \
  --client-secret *** \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso cms
./manage.py lms create_dot_application \
  --grant-type authorization-code \
  --redirect-uris "http://studio.my.domain:8001/complete/edx-oauth2/" \
  --client-id cms-sso-dev \
  --client-secret **** \
  --scopes user_id \
  --skip-authorization \
  --update cms-sso-dev cms


# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

# Create waffle switches to enable some features, if they have not been explicitly defined before
# Completion tracking: add green ticks to every completed unit
(./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on

To be honest, firstly i got Lilac and it’s working ok. But then Lilac was deleted by me. What’s wrong with Maple?

Finally got it right: just comment some strings in tutor/tutor/templates/apps/openedx/settings/partials/common_all.py:

import warnings
#from django.utils.deprecation import RemovedInDjango40Warning, RemovedInDjango41Warning
#warnings.filterwarnings("ignore", category=RemovedInDjango40Warning)
#warnings.filterwarnings("ignore", category=RemovedInDjango41Warning)
warnings.filterwarnings("ignore", category=DeprecationWarning, module="lms.djangoapps.course_wiki.plugins.markdownedx.wiki_plugin")
warnings.filterwarnings("ignore", category=DeprecationWarning, module="wiki.plugins.links.wiki_plugin")

This is not the right solution. If you cannot import RemovedInDjango40Warning then it means that you are running a version of edx-platform that is either too old or too recent. Without further information it’s difficult to help you more.

hi,

Hello, I have the same error I am migrating from lilac to maple

The steps I used to update were those described in the documentation plus the commands suggested during the update, such as:

tutor images build openedx

tutor config save

That you should add them to the documentation since the command save the configuration should be done before starting the platform.

Hmmm I think I understand. Let me get this straight. You ran:

pip install --upgrade tutor
tutor local quickstart

Then, during the upgrade process you received the following message:

Your platform was successfuly upgraded from lilac to maple. Depending on your setup, you might have to rebuild some of your Docker images. You can do this now by running the following command in a different shell:

    tutor images build openedx # add your custom images here

Press enter when you are ready to continue

Which you did. But then you faced the RemovedInDjango40Warning error. Is that correct?

If yes, then the message should also specify that you must run tutor config save prior to tutor images build openedx.

4 posts were split to a new topic: Caddy error with MinIO plugin: “duplicate site address not allowed”

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.