The snap building process throws error at Priming step with error : yaml.constructor.ConstructorError: could not determine a constructor for the tag '!PrimeState'

Bug #1822741 reported by Rishabhh
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Snapcraft
Expired
Undecided
Unassigned

Bug Description

# When I ran the snapcraft for the first time it ran perfectly and created the hello-world_2.1_amd64.snap but then I tried adding an 'apps' part and ran 'snapcraft prime' but it started to throw this error after that. From then on I tried removing everything from snap to multipass to snapcraft and created the same snap again but this error kept on propping.

# snapcraft.yaml file attached

ERROR LOG Below

Staging helloworld
Priming helloworld
/usr/lib/python3/dist-packages/snapcraft/internal/states/_state.py:96: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  state = yaml.load(f.read())
Sorry, an error occurred in Snapcraft:
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 9, in <module>
    load_entry_point('snapcraft==2.43.1', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1037, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/_runner.py", line 93, in run
    ctx.forward(lifecyclecli.commands["snap"])
  File "/usr/lib/python3/dist-packages/click/core.py", line 552, in forward
    return self.invoke(cmd, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 136, in snap
    project = _execute(steps.PRIME, parts=[], **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/lifecycle.py", line 35, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 90, in execute
    executor.run(step, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 196, in run
    self._create_meta(step, processed_part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/_runner.py", line 354, in _create_meta
    common.env = self.config.snap_env()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/project_loader/_config.py", line 289, in snap_env
    dependency_paths |= part.get_primed_dependency_paths()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 885, in get_primed_dependency_paths
    state = self.get_prime_state()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 144, in get_prime_state
    self._prime_state = cast(states.PrimeState, self.get_state(steps.PRIME))
  File "/usr/lib/python3/dist-packages/snapcraft/internal/pluginhandler/__init__.py", line 148, in get_state
    return states.get_state(self.plugin.statedir, step)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/states/_state.py", line 96, in get_state
    state = yaml.load(f.read())
  File "/usr/local/lib/python3.5/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 43, in get_single_data
    return self.construct_document(node)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 47, in construct_document
    data = self.construct_object(node)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 92, in construct_object
    data = constructor(self, node)
  File "/usr/local/lib/python3.5/dist-packages/yaml/constructor.py", line 420, in construct_undefined
    node.start_mark)
yaml.constructor.ConstructorError: could not determine a constructor for the tag '!PrimeState'
  in "<unicode string>", line 1, column 1:
    !PrimeState
    ^

Revision history for this message
Rishabhh (rishabhh) wrote :
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

It seems the snapcraft version you are using was pip installed, we do not support that unless developing snapcraft itself, mind removing that install and instead `snap install snapcraft --classic` and trying again?

Changed in snapcraft:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Snapcraft because there has been no activity for 60 days.]

Changed in snapcraft:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.