Snapcraft build fails

Trying to build an example snap and it fails the build. Just learning how snapcraft works, but this simple examples fails each time and I cannot identify what is going wrong. Any help would be appreciated.


$ sudo snap install --classic snapcraft

Ubuntu Version: Ubuntu 16.04.5 LTS

$ python -V
Python 2.7.12
$ snapcraft --version
snapcraft, version 2.43.1
$ dpkg -l | grep build-esse
ii  build-essential                                             12.1ubuntu2                                  amd64        Informational list of build-essential packages
dumpinfo$ tree
├── dumpinfo
│   ├──
│   └──
├── requirements.txt
└── snap
    └── snapcraft.yaml

2 directories, 6 files
from setuptools import setup

   description='Test Dump tool',
   author='John Doe',
   packages=['dumpinfo'],  #same as name
name: dumpinfo
version: '0.1' 
summary: DumpInfo program
description: |
  This is a test program for creating a snap.

grade: devel 
confinement: devmode

    plugin: python
    python-version: python2
    source: . 

    command: bin/
import json

test = { "fname":"John","lname":"Doe","age":42}
print json.dumps(test)
$ snapcraft
<Cut all the stuff that  went right>
Staging dumpinfo 
Priming dumpinfo 
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/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/", line 1037, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/", line 93, in run
  File "/usr/lib/python3/dist-packages/click/", line 552, in forward
    return self.invoke(cmd, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/", line 136, in snap
    project = _execute(steps.PRIME, parts=[], **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/", line 35, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/", line 90, in execute, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/", line 196, in run
    self._create_meta(step, processed_part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/", line 359, in _create_meta
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 109, in create_snap_packaging
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 312, in write_snap_yaml
    snap_yaml = self._compose_snap_yaml()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 468, in _compose_snap_yaml
    snap_yaml["apps"] = self._wrap_apps(self._config_data["apps"])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 567, in _wrap_apps
    self._wrap_app(app, apps[app])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 575, in _wrap_app
    app[k] = self._wrap_exe(app[k], "{}-{}".format(k, name))
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 546, in _wrap_exe
    with open(exepath, "rb") as exefile:
FileNotFoundError: [Errno 2] No such file or directory: '/home/myuser/Development/Python/dumpinfo/prime/bin/'
We would appreciate it if you created a bug report at with the above text included.

dumpinfo$ ls prime/bin/

Returns nothing

Can you please paste your snapcraft.yaml with the formatting? You can use markup language to paste it so that we know that the snapcraft.yaml format is correct.

I am assuming it looks like this:


version: ‘0.1’
summary: DumpInfo program
description: |
This is a test program for creating a snap.

grade: devel
confinement: devmode

    plugin: python
    python-version: python2
    source: .

    command: bin/


You nailed it except the line under description “This is a test program for creating a snap.” is indented a bit.

I see no entry points or scripts defined in that, which means bin/ probably doesn’t exist. But you’ve defined an app that uses it, which is confusing snapcraft.

What would that look like? My file looks as such right now:
from setuptools import setup

description=‘Test Dump tool’,
author=‘John Doe’,
packages=[‘dumpinfo’], #same as name

Also, seemed to have gotten around original build issue, but getting the following:
Processing /home/tepkes/Development/Python/dumpinfo/parts/setup/src
Link is a directory, ignoring download_dir
Complete output from command python egg_info:
running egg_info
creating pip-egg-info/dumpinfo.egg-info
writing pip-egg-info/dumpinfo.egg-info/PKG-INFO
writing top-level names to pip-egg-info/dumpinfo.egg-info/top_level.txt
writing dependency_links to pip-egg-info/dumpinfo.egg-info/dependency_links.txt
writing manifest file ‘pip-egg-info/dumpinfo.egg-info/SOURCES.txt’
error: package directory ‘dumpinfo’ does not exist


Command “python egg_info” failed with error code 1 in /tmp/pip-req-build-iaIpjs/
Failed to run ‘/home/tepkes/Development/Python/dumpinfo/parts/setup/install/usr/bin/python2 -m pip download --disable-pip-version-check --dest /home/tepkes/Development/Python/dumpinfo/parts/setup/python-packages simple_json .’: Exited with code 1.

Which could be part of my problem. Any help here would be greatly appreciated. Thanks

You’ve just got good old python issues, now. Have you tried just getting this working in a virtual environment before trying to snap it? Get that working, and the snap will work as well. I’d be happy to help with that if you create a github repo with the project as it stands now, then I can clone it and tell you what the issues are.

I actually got it to build, I found the issue in the setup file, I had a outside of the src dir that it was latching on to. So now it builds, but I get the following:
$ snap list
Name Version Rev Tracking Publisher Notes
core 16-2.36.2 6034 stable canonical✓ core
dumpinfo 0.1 x1 - - devmode
snapcraft 3.0.1 2374 stable canonical✓ classic

$ ls /snap/bin
dumpinfo snapcraft
$ dumpinfo
/snap/dumpinfo/x1/command-dumpinfo.wrapper: 5: exec: /snap/dumpinfo/x1/bin/ not found

$ ls /snap/dumpinfo/x1/bin/
/snap/dumpinfo/x1/bin/ <— so it exists

$ /snap/dumpinfo/x1/bin/
{“lname”: “Doe”, “age”: 42, “fname”: “John”} <— executing this gives me the right output

So in the tree, is in the dumpinfo/ directory. From what I gather havok4u is trying to use the python plugin to install the to bin/.

Yes. The python plugin isn’t magic though-- a proper is needed to make that happen.

Make sure is executable.

It is as I can execute it by doing the following command: /snap/dumpinfo/x1/bin/ d

Also here is my tree:

Development/Python/dumpinfo$ tree
├── snap
│ └── snapcraft.yaml
└── src
├── requirements.txt

2 directories, 6 files

what is the shebang line stating on your file?

If it has an absolute path to python then it won’t work without modifying (e.g. #!/usr/bin/python3). The normal way to fix that is to change it to something like:

#!env python3

Changed to #!env python2
and it didn’t work, but changed to
#!/usr/bin/env python2
and it works now. Thanks

1 Like