I have snapcraft like this:
name: lorem # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '1.1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Lorem ipsum
description: |
Lorem ipsum dolot sit amet
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
parts:
lorem:
source: .
plugin: python
requirements: ['requirements.txt']
apps:
lorem:
command: bin/main.py
bin/main.py:
#!/usr/bin/env python3
from client.main import main
if __name__ == '__main__':
main(prog_name="lorem")
client/main.py:
from click import group, version_option
from .command.configure import configure
...
@group()
@version_option("1.1.0")
def main():
pass
main.add_command(configure)
The directory structure is like this: https://pastebin.com/C8mHY6Rq
I get the following error when running the program after installing the snap:
Traceback (most recent call last): File â/snap/lorem/x1/bin/main.pyâ, line 3, in from client.main import main File â/snap/lorem/x1/lib/python3.8/site-packages/client/init.pyâ, line 1, in from .main import main File â/snap/lorem/x1/lib/python3.8/site-packages/client/main.pyâ, line 4, in from .command.configure import configure ModuleNotFoundError: No module named âclient.commandâ
In requirements.txt I have Click package (which works ok because importing classes and function from that package didnât throw an error). I donât have Client package (which is my self-made package), but that package should be installed when the snap build installs the package based on setup.py. And I think it is installed given this part in the error:
File â/snap/lorem/x1/lib/python3.8/site-packages/client/init.pyâ, line 1, in
But I donât know why that throws that import error, if the client package is installed. The application works if I run this normally (without a snap, simply running the bin/main.py script).
I have also tried adding âclientâ to requirements, but then the build doesnât work I can see that in logs:
ERROR: Could not find a version that satisfies the requirement client~=1.1.0 (from versions: none) ERROR: No matching distribution found for client~=1.1.0
Does anyone know why I get this error? Or what is the solution?
