Home > Software engineering >  Trying to build minimal linux image with Poky , getting python import error
Trying to build minimal linux image with Poky , getting python import error

Time:08-20

I'm trying to buil a minimal linux image using yocto, When I try to run command bitbake core-image-minimal I get an error

from collections import MutableMapping, KeysView, ValuesView, ItemsView, OrderedDict
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

I've read somewhere that MutableMapping is deprecated in Python3. I tried to point to python2.7 instead, but I still have the same error

sudo ln -s /usr/bin/python2.7 /usr/bin/python
python --version
Python 2.7.18

I'm using poky zeus branch, ubuntu 22.04

CodePudding user response:

Using zeus branch, your OS (Ubuntu 22.04) is not in the list of the supported ones.

Here I can see two options (I think there is more, but they are the most simple ones):

  • Install a supported OS on your machine (or on another machine)
  • Use docker

For docker, install it following the official docs for Ubuntu.

Then you can run docker container on your poky folder to execute bitbake commands:

docker run --rm -it -v /path/to/poky:/workdir crops/poky:ubuntu-18.04 --workdir=/workdir
  • Related