Yocto build error | AttributeError: 'LooseVersion' object has no attribute 'version'


Sourabh Hegde
 

Hello,

I am having an issue while building a simple core-image-minimal image. The issue is reported by bitbake. The build machine is remote server with Ubuntu 20.04
Logs:

File "[...]/poky/bitbake/lib/bb/event.py", line 93, in execute_handler
    ret = handler(event)
  File "[...]/build/../poky/meta/classes/sanity.bbclass", line 1048, in defaultcheck_sanity_eventhandler
    check_sanity(sanity_data)
  File "[...]/build/../poky/meta/classes/sanity.bbclass", line 1004, in check_sanity
    check_sanity_everybuild(status, sanity_data)
  File "[...]/build/../poky/meta/classes/sanity.bbclass", line 801, in check_sanity_everybuild
    if (LooseVersion(bb.__version__) < LooseVersion(minversion)):
  File "/usr/lib/python3.8/distutils/version.py", line 52, in __lt__
    c = self._cmp(other)
  File "/usr/lib/python3.8/distutils/version.py", line 335, in _cmp
    if self.version == other.version:
AttributeError: 'LooseVersion' object has no attribute 'version'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "[...]/poky/bitbake/lib/bb/command.py", line 114, in runAsyncCommand
    self.cooker.updateCache()
  File "[...]/poky/bitbake/lib/bb/cooker.py", line 1612, in updateCache
    bb.event.fire(bb.event.SanityCheck(False), self.databuilder.mcdata[mc])
  File "[...]/poky/bitbake/lib/bb/event.py", line 216, in fire
    fire_class_handlers(event, d)
  File "[...]/poky/bitbake/lib/bb/event.py", line 123, in fire_class_handlers
    execute_handler(name, handler, event, d)
  File "[...]/poky/bitbake/lib/bb/event.py", line 98, in execute_handler
    logger.error("Execution of event handler '%s' failed" % name,
  File "/usr/lib/python3.8/logging/__init__.py", line 1475, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
    self.handle(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
    self.emit(record)
  File "[...]/poky/bitbake/lib/bb/event.py", line 752, in emit
    tb = list(bb.exceptions.extract_traceback(tb, context=3))
  File "[...]/poky/bitbake/lib/bb/exceptions.py", line 64, in extract_traceback
    formatted_args, cls = _get_frame_args(frame)
  File "[...]/poky/bitbake/lib/bb/exceptions.py", line 58, in _get_frame_args
    formatted = inspect.formatargvalues(*arginfo)
  File "/usr/lib/python3.8/inspect.py", line 1296, in formatargvalues
    specs.append(convert(args[i]))
  File "/usr/lib/python3.8/inspect.py", line 1293, in convert
    return formatarg(name) + formatvalue(locals[name])
  File "/usr/lib/python3.8/inspect.py", line 1284, in <lambda>
    formatvalue=lambda value: '=' + repr(value)):
  File "/usr/lib/python3.8/distutils/version.py", line 328, in __repr__
    return "LooseVersion ('%s')" % str(self)
  File "/usr/lib/python3.8/distutils/version.py", line 324, in __str__
    return self.vstring
AttributeError: 'LooseVersion' object has no attribute 'vstring'

Can anyone please let me know what is the issue here and how to resolve this?


Ross Burton
 

On 23 Mar 2023, at 12:41, Sourabh Hegde via lists.yoctoproject.org <hrsourabh011=gmail.com@...> wrote:
I am having an issue while building a simple core-image-minimal image. The issue is reported by bitbake. The build machine is remote server with Ubuntu 20.04
Logs:
What release of yocto is this?

Ross


Sourabh Hegde
 

Hello Ross,

I am working with hardknott release


Ross Burton
 

On 27 Mar 2023, at 07:26, Sourabh Hegde via lists.yoctoproject.org <hrsourabh011=gmail.com@...> wrote:

Hello Ross,

I am working with hardknott release
First, Hardknott has been end-of-life for a year now, please upgrade.

There are two related problems:

AttributeError: 'LooseVersion' object has no attribute 'version'
AttributeError: 'LooseVersion' object has no attribute ‘vstring'

Both of which suggest that LooseVersion.parse() wasn’t called, meaning it was passed a None instead of a string. At the line before it does the comparison in sanity.bbclass, printing out the value of min_version and bb.__version__ using bb.warn() would be interesting.

Can you share the entire build output, specificially the bitbake version and layer revisions?

Ross