Re: [yocto] [Scarthgap] "ModuleNotFoundError: No module named 'imp'"

simone bongini <[email protected]>
Newsgroups org.yoctoproject.lists.yocto
Message-ID <CAHdr16qK++o8tZpYrUQkTb_hSzpX4HfYOD7ijSoPQrpEppo40Q@mail.gmail.com>
Hello,
I'm not able to find log.do_configure from libdnf-native, but....

From the generated error.py of libdnf file I can read

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are
doing--modify
# the SWIG interface file instead.

Indeed I got that the proper version is the 4.2.1, but seems generated from
3.0.8 version



Il giorno mer 15 ott 2025 alle ore 09:56 Gyorgy Sarvari <
[email protected]> ha scritto:

> On 10/14/25 12:43, simone bongini via lists.yoctoproject.org wrote:
> > Hello All
> > i'm trying to build an image based on scarthgap.
> > I'm facing
> >
> > ERROR: our-image-initramfs-1.0-r0 do_rootfs: Could not invoke dnf.
> > Command
> >
> '/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/bin/dnf
> > -v --rpmverbosity=info -y -c
> >
> /home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/rootfs/etc/dnf/dnf.conf
> >
> --setopt=reposdir=/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/rootfs/etc/yum.repos.d
> >
> --installroot=/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/rootfs
> >
> --setopt=logdir=/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/temp
> >
> --repofrompath=oe-repo,/home/devlinux/board.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/oe-rootfs-repo
> > makecache --refresh' returned 1:
> > Traceback (most recent call last):
> >   File
> >
> "/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/bin/dnf.real",
> > line 61, in <module>
> >     from dnf.cli import main
> >   File
> >
> "/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/lib/python3.12/site-packages/dnf/__init__.py",
> > line 30, in <module>
> >     import dnf.base
> >   File
> >
> "/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/lib/python3.12/site-packages/dnf/base.py",
> > line 29, in <module>
> >     import libdnf.transaction
> >   File
> >
> "/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/lib/python3.12/site-packages/libdnf/__init__.py",
> > line 8, in <module>
> >     from . import error
> >   File
> >
> "/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/lib/python3.12/site-packages/libdnf/error.py",
> > line 28, in <module>
> >     _error = swig_import_helper()
> >              ^^^^^^^^^^^^^^^^^^^^
> >   File
> >
> "/home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/recipe-sysroot-native/usr/lib/python3.12/site-packages/libdnf/error.py",
> > line 15, in swig_import_helper
> >     import imp
> > ModuleNotFoundError: No module named 'imp'
> >
> > ERROR: Logfile of failure stored in:
> >
> /home/devlinux/BOARD.1/scarthgap/board-bsp/build-sd96/tmp/work/sama5d27-poky-linux-gnueabi/our-image-initramfs/1.0/temp/log.do_rootfs.3572531
> > ERROR: Task
> >
> (/home/devlinux/BOARD.1/scarthgap/board-bsp/meta-sd96/meta-sd96/recipes-core/initramfs/our-image-initramfs.bb:
> do_rootfs)
> > failed with exit code '1'
> >
> > issue caused by Python 3.12 that is not compatible with "imp" library.
> > But, why swig in scarthgap generate error.py that includes "imp" library?
>
> Interesting question - I think also that it shouldn't do that.
> Random first thought: if you look into the log.do_configure of
> libdnf-native, what does it say, which version of swig did it find, and
> at what path? Is it v4.2.1, somewhere from ${RECIPE_SYSROOT_NATIVE}?
>
> >
> > our-image-initramfs.bb <http://our-image-initramfs.bb> is an our
> > recipes that inherit core-image in order to create a DM-Verity fitImage.
> > Note that it works with kirkstone poky.
> >
> > Thank you all,
> > SB
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#65930):
> https://lists.yoctoproject.org/g/yocto/message/65930
> > Mute This Topic: https://lists.yoctoproject.org/mt/115750455/6084445
> > Group Owner: [email protected]
> > Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [
> [email protected]]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.