Bug 14888 - python3-django: Default version in layer not supported anymore, missing dependency for current versions
Summary: python3-django: Default version in layer not supported anymore, missing depen...
Status: RESOLVED INVALID
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Undecided normal
Target Milestone: ---
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
: 14889 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-08-16 09:06 UTC by Johannes Schrimpf
Modified: 2022-08-29 07:28 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Patch to pull python3-asgiref package for python3-django. (3.19 KB, patch)
2022-08-17 14:41 UTC, Jagadeesh Krishnanjanappa
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Schrimpf 2022-08-16 09:06:14 UTC
The newer meta-python versions (honister, kirkstone, master) still use python3-django version 2.2 as default preference, stating in the newer recipes that the LTS version should be build by default. However, 2.2 had end of extended support April 11, 2022. The current LTS is 3.2, which is available as recipe in the layers, but not activated as default.

https://www.djangoproject.com/download/

Additionally, python3-django version 3.2 and 4.x depend on python3-asgiref, which is missing as dependency in the recipes and not part of meta-python.
Comment 1 Johannes Schrimpf 2022-08-16 13:37:20 UTC
*** Bug 14889 has been marked as a duplicate of this bug. ***
Comment 2 Jagadeesh Krishnanjanappa 2022-08-17 14:41:27 UTC
Created attachment 4897 [details]
Patch to pull python3-asgiref package for python3-django.
Comment 3 Jagadeesh Krishnanjanappa 2022-08-17 14:43:40 UTC
Though python3-django needs python3-asgiref it does not
break while building python3-django v3.2.12 and v4.0.2.
This probably is the reason why python3-asgiref recipe 
was not added.

This can be verified with the following changes for kirkstone.

diff --git a/meta-python/recipes-devtools/python/python3-django_3.2.12.bb b/meta-python/recipes-devtools/python/python3-django_3.2.12.bb
index adbc498bd..9e9d6768d 100644
--- a/meta-python/recipes-devtools/python/python3-django_3.2.12.bb
+++ b/meta-python/recipes-devtools/python/python3-django_3.2.12.bb
@@ -10,4 +10,4 @@ RDEPENDS:${PN} += "\
 # Set DEFAULT_PREFERENCE so that the LTS version of django is built by
 # default. To build the 3.x branch,
 # PREFERRED_VERSION_python3-django = "3.2.2" can be added to local.conf
-DEFAULT_PREFERENCE = "-1"
+#DEFAULT_PREFERENCE = "-1"
diff --git a/meta-python/recipes-devtools/python/python3-django_4.0.2.bb b/meta-python/recipes-devtools/python/python3-django_4.0.2.bb
index 690b9809d..84348e0af 100644
--- a/meta-python/recipes-devtools/python/python3-django_4.0.2.bb
+++ b/meta-python/recipes-devtools/python/python3-django_4.0.2.bb
@@ -10,4 +10,4 @@ RDEPENDS:${PN} += "\
 # Set DEFAULT_PREFERENCE so that the LTS version of django is built by
 # default. To build the 4.x branch,
 # PREFERRED_VERSION_python3-django = "4.0.2" can be added to local.conf
-DEFAULT_PREFERENCE = "-1"
+#DEFAULT_PREFERENCE = "-1"

and adding any of the two lines in the conf/local.conf.
PREFERRED_VERSION_python3-django = "4.0.2"
PREFERRED_VERSION_python3-django = "3.2.12"

But yes it crashes while running /usr/bin/django-admin.
-- snip --
root@qemuarm:~# /usr/bin/django-admin
Traceback (most recent call last):
  File "/usr/bin/django-admin", line 5, in <module>
    from django.core.management import execute_from_command_line
  File "/usr/lib/python3.10/site-packages/django/core/management/__init__.py", line 13, in <module>
    from django.apps import apps
  File "/usr/lib/python3.10/site-packages/django/apps/__init__.py", line 1, in <module>
    from .config import AppConfig
  File "/usr/lib/python3.10/site-packages/django/apps/config.py", line 7, in <module>
    from django.utils.deprecation import RemovedInDjango41Warning
  File "/usr/lib/python3.10/site-packages/django/utils/deprecation.py", line 5, in <module>
    from asgiref.sync import sync_to_async
ModuleNotFoundError: No module named 'asgiref'
root@qemuarm:~#
-- snip --

With the attached [patch|https://bugzilla.yoctoproject.org/attachment.cgi?id=4897&action=edit] for kirkstone, /usr/bin/django-admin runs correctly
(though not all options are tested).

-- snip --
root@qemuarm:~# /usr/bin/django-admin shell
Python 3.10.4 (main, Mar 23 2022, 20:25:24) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
now exiting InteractiveConsole...
root@qemuarm:~#
-- snip --

If the changes look good then I will try to push
to meta-openembedded mailing list.

Regards,
Jagadeesh
Comment 4 Randy MacLeod 2022-08-18 14:40:39 UTC
This isn't a Yocto ( bitbake or oe-core ) bug since the recipe is in meta-openembedded.
Please post a patch or report the bug to the list / layer maintainers where such things are handled: openembedded-devel@lists.openembedded.org

-- YP Triage meeting.
Comment 5 Jagadeesh Krishnanjanappa 2022-08-28 14:54:08 UTC
For the record, the patches are merged in the meta-openembedded layer at https://git.openembedded.org/meta-openembedded/log/meta-python/recipes-devtools/python.

Regards,
Jagadeesh
Comment 6 Johannes Schrimpf 2022-08-29 07:28:56 UTC
Thank you Jagadeesh!

Best regards,
Johannes