# Django Installed Apps Error after Quickstart on M1

**URL:** <https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486>\
**Category:** Development\
**Tags:** tutor, maple\
**Created:** [October 12, 2022, 8:37am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486 "2022-10-12T08:37:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![uetuluk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/uetuluk/32/3015_2.png) [@uetuluk](https://discuss.openedx.org/u/uetuluk)\
**Post date:** [October 12, 2022, 8:37am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/1 "2022-10-12T08:37:55Z")

</div>

Hello Everyone,

I am working on setting up my development environment on an M1 Macbook and have followed the following guide: [Open edX Devstack Development with Apple Macbook M1 Silicon (ARM Architecture)](https://discuss.openedx.org/t/open-edx-devstack-development-with-apple-macbook-m1-silicon-arm-architecture/5051)

I am still using the Maple version and v13.3.1 of Tutor since we cannot make significant changes currently.

Therefore, I have built the images locally using my fork of maple.3 tag using the --build-arg argument.

I have also changed the MySQL image to MariaDB as suggested.

I can run `tutor local quickstart` without a problem, however, once I try to open `local.overhang.io` it shows Internal Server Error and the logs for **lms** and **cms** show the following problem.

```auto
Model class openedx.core.djangoapps.content_libraries.models.ContentLibrary doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
ERROR: 1

```

I have only found one more person with this problem here, however, it does not seem like their problem is solved: [Tutor in development, error 1 import imp - #3 by Leonn - Tutor - Overhang.IO](https://discuss.overhang.io/t/tutor-in-development-error-1-import-imp/2166/3)

I would like to ask if anyone has any clues as to what might have gone wrong.

I would also like to add that the exact same configuration works on an Intel Macbook.

---

<div class="post-metadata">

**Author:** ![braden](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/braden/32/46_2.png) [@braden](https://discuss.openedx.org/u/braden)\
**Post date:** [October 12, 2022, 10:38pm UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/2 "2022-10-12T22:38:40Z")

</div>

I don’t think the problem is related to M1/ARM nor to MariaDB; it seems like a python/django installation or configuration issue.

`content_libraries` is a Django app plugin, so [this line in setup.py](https://github.com/openedx/edx-platform/blob/b8e31d47ed7dd06f53d88167c4063afc433a06fe/setup.py#L93) should result in it being “auto-detected” by the system, and automatically added to INSTALLED\_APPS. Yet for some reason it’s not in INSTALLED\_APPS. Is there more context to the logs so we can see at what point the error is occurring?

I would guess at some possibilities:

- Perhaps `edx-platform` is not installed correctly into the python virtual environment. From an LMS shell, in the `edx-platform` directory, you can try running `pip install -e .` and then `./manage.py lms shell` to see if that resolves it.
- Perhaps something is modifying `INSTALLED_APPS` and removing `content_libraries`. I am not sure what that would be.
- I think the system should also generally work with content\_libraries uninstalled, so I’m wondering what code is referencing the `content_libraries` app even though it appears to be uninstalled. Perhaps the full error message may provide more clues.

---

<div class="post-metadata">

**Author:** ![uetuluk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/uetuluk/32/3015_2.png) [@uetuluk](https://discuss.openedx.org/u/uetuluk)\
**Post date:** [October 13, 2022, 2:12am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/3 "2022-10-13T02:12:46Z")

</div>

Thank you Braden for the tips!

We will investigate these possibilities.

---

<div class="post-metadata">

**Author:** ![uetuluk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/uetuluk/32/3015_2.png) [@uetuluk](https://discuss.openedx.org/u/uetuluk)\
**Post date:** [October 13, 2022, 6:10am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/4 "2022-10-13T06:10:17Z")

</div>

The first suggestion of running `pip install -e .` inside the LMS shell worked.

---

<div class="post-metadata">

**Author:** ![uetuluk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/uetuluk/32/3015_2.png) [@uetuluk](https://discuss.openedx.org/u/uetuluk)\
**Post date:** [October 13, 2022, 7:00am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/5 "2022-10-13T07:00:39Z")

</div>

For anyone who meets this issue, the problem was simpler than that.

I bind volume a clean fork of our edx-platform to the containers instead of exporting the fork from the image, and working on the exported version of the fork.

This meant that none of the commands to build the assets, install the openedx app etc actually run on the edx-platform directory.

---

<div class="post-metadata">

**Author:** ![tiendv89](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tiendv89/32/4721_2.png) [@tiendv89](https://discuss.openedx.org/u/tiendv89)\
**Post date:** [January 5, 2023, 1:45am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/6 "2023-01-05T01:45:04Z")

</div>

I dont’t quite get the solution here.

I was following this

```auto
# Run bash in the lms container
tutor dev run --mount=/path/to/edx-platform lms bash

# Compile local python requirements
pip install --requirement requirements/edx/development.txt

# Install nodejs packages in node_modules/
npm clean-install

# Rebuild static assets
openedx-assets build --env=dev

```

which I suppose to run within the container mounted directory but still met the same error ☹

Could you please explain a bit more on your solution

---

<div class="post-metadata">

**Author:** ![uetuluk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/uetuluk/32/3015_2.png) [@uetuluk](https://discuss.openedx.org/u/uetuluk)\
**Post date:** [January 5, 2023, 6:23am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/7 "2023-01-05T06:23:03Z")

</div>

@tiendv89 There might be many reasons for your problem. Additionally, I am running v13.3.1 which is not the latest version and things might have changed since.

Please create a new topic with the following information:

- Version of Tutor and Open edX you are trying to run
- What you have done to make Tutor work on M1, in addition to the steps you have shared.
- The exact error and the log messages

---

<div class="post-metadata">

**Author:** ![tiendv89](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tiendv89/32/4721_2.png) [@tiendv89](https://discuss.openedx.org/u/tiendv89)\
**Post date:** [January 5, 2023, 6:32am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/8 "2023-01-05T06:32:17Z")

</div>

I am working with the open-release/olive.1 tag.

I have been successfully used `tutor local` and `tutor k8s`.

I am trying to learn how to set up openedx develop environment and decide to go with `tutor dev`.

By runnning `tutor dev start -d --mount=/path/to/edx-platform lms` I met the issue:  
`Model class openedx.core.djangoapps.content_libraries.models.ContentLibrary doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.`

---

<div class="post-metadata">

**Author:** ![tiendv89](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/tiendv89/32/4721_2.png) [@tiendv89](https://discuss.openedx.org/u/tiendv89)\
**Post date:** [January 5, 2023, 6:38am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/9 "2023-01-05T06:38:20Z")

</div>

And yes, I use a clean fork of the `edx-platform` and mount it to lms container.

From what I understand about your solution, I am trying to use `copyfrom` to copy the edx-platform on the running lms to my host machine and mount it back (however it still take long time to copy and haven’t worked out yet)

---

<div class="post-metadata">

**Author:** ![uetuluk](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/uetuluk/32/3015_2.png) [@uetuluk](https://discuss.openedx.org/u/uetuluk)\
**Post date:** [January 5, 2023, 7:05am UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/10 "2023-01-05T07:05:13Z")

</div>

> [@tiendv89](#):
>
> I am trying to use `copyfrom` to copy the edx-platform on the running lms to my host machine and mount it back

Yes, that is how I solved the problem. The copy process does take upwards of 10 minutes to complete.

---

<div class="post-metadata">

**Author:** ![Zachary\_Trabookis](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/zachary_trabookis/32/753_2.png) [@Zachary\_Trabookis](https://discuss.openedx.org/u/Zachary_Trabookis)\
**Post date:** [August 31, 2023, 9:04pm UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/11 "2023-08-31T21:04:31Z")

</div>

I too ran into this issue with Nutmeg release after trying to volume map directly after a quickstart or launch had provisioned.

> tutor\_nutmeg\_dev-lms-1 | RuntimeError: Model class openedx.core.djangoapps.content\_libraries.models.ContentLibrary doesn’t declare an explicit app\_label and isn’t in an application in INSTALLED\_APPS.

I used the [docker cp | Docker Docs](https://docs.docker.com/engine/reference/commandline/cp/) command to copy the default LMS Container install of `edx-platform` to my host machine using this command. Copying the platform directory didn’t take too long (less than a minute).

```auto
# Copy files from LMS container to Host machine
docker cp -a tutor_nutmeg_dev-lms-1:/openedx/edx-platform .

Ref: https://stackoverflow.com/questions/54213420/convert-shallow-repo-to-normal-repo 
# Unshallow the git repo (convert the shallow clone to regular one).
cd edx-platform
git fetch --unshallow

# Get access to all the branches on origin.
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin

```

I’m using Tutor from source, so I created a file at `tutor/tutor/templates/dev/docker-compose.override.yml` with the following volume mappings and performed a `tutor config save` to put this file out in the Tutor env before I issued a `tutor local restart` to make the volume mappings work. I followed instructions here [Open edX development — Tutor documentation (overhang.io)](https://docs.tutor.overhang.io/dev.html#override-docker-compose-volumes) for this mapping file.

```auto
version: "3.7"
services:
  lms:
    volumes:
      - /path/to/open-edx/tutor.dev.nutmeg/edx-platform:/openedx/edx-platform
  cms:
    volumes:
      - /path/to/open-edx/tutor.dev.nutmeg/edx-platform:/openedx/edx-platform
  lms-worker:
    volumes:
      - /path/to/open-edx/tutor.dev.nutmeg/edx-platform:/openedx/edx-platform
  cms-worker:
    volumes:
      - /path/to/open-edx/tutor.dev.nutmeg/edx-platform:/openedx/edx-platform

```

After a restart I verified that the `RuntimeError: openedx.core.djangoapps.content_libraries` went away and that the LMS and CMS pages would load properly. This seemed to work just fine.

**Debugging**  
I set a breakpoint in the LMS Dashboard view function to see that I could breakpoint then also made sure that I was attached to the LMS Container by running the following command.

```auto
# If the LMS doesn't reload after inserting the breakpoint and saving the file, then issue the following command as indicated in this guide.
# Ref: https://docs.tutor.overhang.io/local.html#reloading-open-edx-settings
tutor dev exec lms reload-uwsgi

# Attach to the LMS Container for debugging
docker container attach tutor_nutmeg_dev-lms-1

```

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/3/3d02a3b5eec0f3e706551c2cb6c65137a6c6ae7d.png)

**Use a Forked edx-platform**  
I think from here what I’ll do is make sure that I’ll have a fork that based on this container `edx-platform` commits and apply our company’s specific changes. If there were any changes to models.py to ensure that migrations get applied.

It looks like I have the `openedx-release/nutmeg.2` tag installed along with some patches added by the Dockerfile from `openedx` image. Patches came from [tutor/tutor/templates/build/openedx/Dockerfile at v14.2.3 · overhangio/tutor (github.com)](https://github.com/overhangio/tutor/blob/v14.2.3/tutor/templates/build/openedx/Dockerfile#L49-L64)

I created a branch titled `open-release/nutmeg.install` here.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/openedx/original/2X/f/fe4b2182aaa931299b60b6afc2b2062548d0d69b.png)

cc @becdavid @traek728

---

<div class="post-metadata">

**Author:** ![farhaanbukhsh](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/farhaanbukhsh/32/1503_2.png) [@farhaanbukhsh](https://discuss.openedx.org/u/farhaanbukhsh)\
**Post date:** [December 10, 2024, 8:41pm UTC](https://discuss.openedx.org/t/django-installed-apps-error-after-quickstart-on-m1/8486/12 "2024-12-10T20:41:42Z")

</div>

I faced this error while I was configuring it on M3 chip and I felt really silly because it was my fault, I was doing a `tutor dev start -d` without running `tutor dev launch` which made Tutor skip a bunch of configuration steps.
