Snapcraft init fails and reports missing data files

Hi, I’m trying to use snapcraft to compile a project for the first time. However, when I use snapcraft init, it throws the following error.

Traceback (most recent call last):
File "/home/cibin/.local/bin/snapcraft", line 5, in <module>
from snapcraft.cli.__main__ import run
File "/home/cibin/.local/lib/python3.6/site-packages/snapcraft/__init__.py", line 343, in <module>
from snapcraft._store import ( # noqa File "/home/cibin/.local/lib/python3.6/site-packages/snapcraft/_store.py", line 32, in <module>
from snapcraft.cli import echo
File "/home/cibin/.local/lib/python3.6/site-packages/snapcraft/cli/__init__.py", line 18, in <module>
snapcraft.internal.dirs.setup_dirs()
File "/home/cibin/.local/lib/python3.6/site-packages/snapcraft/internal/dirs.py", line 120, in setup_dirs
raise snapcraft.internal.errors.SnapcraftDataDirectoryMissingError()
snapcraft.internal.errors.SnapcraftDataDirectoryMissingError: Cannot find snapcraft's data files required for proper operation.
Please re-install snapcraft or verify installation is correct.

I’ve tried removing snapcraft using snap remove --purge snapcraft and then reinstalling using snap install snapcraft --classic and everything appears to work fine until snapcraft init is issued.

This is the output of snap version for me:
snap 2.51.1
snapd 2.51.1
series 16
ubuntu 18.04
kernel 4.15.0-147-generic

How do I resolve this error with snapcraft?

For some reason, Snapcraft ends up loading packages from you user site directory, pip uninstall --user snapcraft should workaround that problem.

1 Like

Thanks, that seems to have resolved it!