Snapping python applicaiton: The specified command does not exist

I’ve been grinding away at Snapcraft for a few days now but no matter how hard I try I can’t seem to get past this one issue:

I’ve developed an application and am looking to install it on Ubuntu Core 20 which of course, requires applications to be snapped for security reasons. In order to snap the application I’ve added the necessary files to make it a setuptools compatible package.

Having followed all of the guides and tutorials I can find, I have the following in my snap/snapcraft.yaml:

name: application-name
base: core20
version: '0.1.0'
summary: Single-line elevator pitch for your amazing snap
description: |
  This is my-snap's description.

grade: devel
confinement: devmode

    plugin: python
    source: .

    command: application-name

The file structure is:

  • ApplicationName/
    • Module_x/
    • Module_y/
    • Module_z/
    • snap/
      • snapcraft.yaml

Despite having followed all of the steps I can find here, there, or anywhere, I’m always greeted by:

Skipping pull application-name (already ran)
Skipping build application-name (already ran)
Skipping stage application-name (already ran)
Skipping prime application-name (already ran)

Failed to generate snap metadata: The specified command 'application-name' defined in the app 'application-name' does not exist.
Ensure that 'application-name' is installed with the correct path.

Run the same command again with --debug to shell into the environment if you wish to introspect this failure.

Can anyone point me in the direction of the solution perchance?

Thanks in advance,

if you’d run your manually (independent of snapcraft), where would application-name be installed ?

I assume (and I say this reservedly because I’m not familiar with setuptools packages) that it ends up in a newly created dist directory within the source directory. Unfortunately I’ve not had much experience in making python applications available as packages.

well, wherever it goes … i.e. if it would install to /usr/bin/application-name usually … or to ./myapp/foo/bar/application-name, you’d have to reflect that in the command: line … i.e. in the latter case the line would look like:

    command: myapp/foo/bar/application-name

try running snapcraft with --debug, that should drop you to a shell inside the build environment and then take a deeper look at the prime/ directory … there try to find the path where application-name actually ends up and use that in the command: entry …

Looking in the prime directory I can’t seem to find it anywhere :confused: When I look into the parts directory it is there but the src directory within parts/applicaiton-name is empty. Am I missing a step somewhere?

well, snapcraft just processes your, whatever is missing to install your app somewhere must be missing in there …

I had the same error when moving from core18 to core20 (core18 worked fine before). Changing

command: application-name


command: bin/application-name

fixed the issue for me.

Btw, make sure that your actually installs your script.