AppImageCrafters / appimage-builder

GNU/Linux packaging solution using the AppImage format
MIT License
316 stars 58 forks source link

Miscellaneous Python errors when trying to build an AppImage #197

Open padsp-64 opened 2 years ago

padsp-64 commented 2 years ago

Hello! Thank you very much for developing a project like appimage-builder. However, despite the fact that it is intended to simplify the task of assembling applications in AppImage, I encountered difficulties and I will write about them below:

When trying to build an app in AppImage when calling appimage-builder (including --generate), I get Python errors 99% of the time. Of all the applications that I tried to create in AppImage, only the Converseen program package was created, however, it did not start, giving an error: "APPRUN_ERROR: No such file or directory"

What programs I tried to make portable:

File Roller, Ark (KDE archive manager), Thunar, PCManFM, uGet. And not only my list is limited to them, Python errors always appear!

I also tried to manually create the AppImageBuilder.yml by following the examples as appimage-builder --generate gave the same Python errors

Here is an example with uGet:

appimage-builder --generate INFO:Generator:Searching AppDir ? ID [Eg: com.example.app]: uget-gtk ? Application Name: uGet ? Icon: uget-icon ? Executable path relative to AppDir [usr/bin/app]: usr/bin/uget-gtk Traceback (most recent call last): File "/tmp/.mount_appimaIMFY7o//usr/bin/appimage-builder", line 8, in sys.exit(main()) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/main.py", line 44, in main generator.generate() File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/modules/generate/command_generate.py", line 76, in generate recipe = self.generator.generate(self.app_dir) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/modules/generate/recipe_generator.py", line 50, in generate bundle_info = self._bundle_info_gatherer.gather_info(app_dir) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/modules/generate/bundle_info_gatherer.py", line 53, in gather_info self._confirm_application_information(self._bundle_info) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/modules/generate/bundle_info_gatherer.py", line 87, in _confirm_application_information app_info.exec_args = self._confirm_application_exec_args(app_info.exec_args) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/modules/generate/bundle_info_gatherer.py", line 111, in _confirm_application_exec_args return self._ui.ask_text("Arguments [Default: $@]:", default=preset) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/appimagebuilder/modules/generate/bundle_info_gatherer_cli.py", line 23, in ask_text question = questionary.text( File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/questionary/prompts/text.py", line 98, in text p.default_buffer.reset(Document(default)) File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/site-packages/prompt_toolkit/document.py", line 128, in init self._cache = _text_to_document_cache[self.text] File "/tmp/.mount_appimaIMFY7o/usr/lib/python3.8/weakref.py", line 131, in getitem o = self.data[key]() TypeError: unhashable type: 'list'

Unfortunately, I'm not a programmer, so I don't know why this happens, and as I wrote above, this happens 99% of the time when trying to create any AppImage program. Also note that I have Python 3.9 installed on my system (distribution is Debian 11)

Please tell me what I am doing wrong and how to solve this problem? Thank you in advance!

padsp-64 commented 2 years ago

I also show what I have in my handcrafted AppImageBuiler.yml:

version: 1

AppDir:
  path: ./AppDir

  app_info:
    id: uget-gtk
    name: uGet
    icon: uget-icon
    version: 2.2.3
    exec: usr/bin/uget-gtk

  apt:
    arch: x86_64
    sources:
      - sourceline: 'deb http://ftp.pl.debian.org/debian/ bullseye main contrib non-free'
      - sourceline: 'deb http://security.debian.org/debian-security bullseye-security main contrib non-free'
      - sourceline: 'deb http://ftp.pl.debian.org/debian bullseye-updates main contrib non-free'

    include:
      - librsvg2-common
      - libcairo2
      - libcurl4
      - libgdk-pixbuf2.0-0
      - libglib2.0-0
      - libgstreamer1.0-0
      - libgtk-3-0
      - libnotify4
      - libpango-1.0-0
      - libpangocairo-1.0-0
      - libssl1.1
      - aria2
      - curl
    exclude:

  files:
    exclude:
      - usr/share/man
      - usr/share/doc/*/README.*
      - usr/share/doc/*/changelog.*
      - usr/share/doc/*/NEWS.*
      - usr/share/doc/*/TODO.*

  test:
    debian:
      image: appimagecrafters/tests-env:debian-stable
      command: "./AppRun"
      use_host_x: True
    centos:
      image: appimagecrafters/tests-env:centos-7
      command: "./AppRun"
      use_host_x: True
    arch:
      image: appimagecrafters/tests-env:archlinux-latest
      command: "./AppRun"
      use_host_x: True
    fedora:
      image: appimagecrafters/tests-env:fedora-30
      command: "./AppRun"
      use_host_x: True
    ubuntu:
      image: appimagecrafters/tests-env:ubuntu-xenial
      command: "./AppRun"
      use_host_x: True

AppImage:
  arch: x86_64

So is the error that appears in this case:

appimage-builder Traceback (most recent call last): File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 396, in validate nvalue = Schema(svalue, error=e, ignore_extra_keys=i).validate(value) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 355, in validate data = Schema(type(s), error=e).validate(data) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 431, in validate raise SchemaUnexpectedTypeError(message, e.format(data) if e else None) schema.SchemaUnexpectedTypeError: None should be instance of 'list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 434, in validate return s.validate(data) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 400, in validate raise SchemaError([message] + x.autos, [e.format(data) if e else None] + x.errors) schema.SchemaError: Key 'exclude' error: None should be instance of 'list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 396, in validate nvalue = Schema(svalue, error=e, ignore_extra_keys=i).validate(value) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 436, in validate raise SchemaError([None] + x.autos, [e.format(data) if e else None] + x.errors) schema.SchemaError: Key 'exclude' error: None should be instance of 'list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 434, in validate return s.validate(data) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 400, in validate raise SchemaError([message] + x.autos, [e.format(data) if e else None] + x.errors) schema.SchemaError: Key 'apt' error: Key 'exclude' error: None should be instance of 'list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 396, in validate nvalue = Schema(svalue, error=e, ignore_extra_keys=i).validate(value) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 436, in validate raise SchemaError([None] + x.autos, [e.format(data) if e else None] + x.errors) schema.SchemaError: Key 'apt' error: Key 'exclude' error: None should be instance of 'list'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/.mount_appimaBHS1Cp//usr/bin/appimage-builder", line 8, in sys.exit(main()) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/appimagebuilder/main.py", line 52, in main schema.validate(recipe_roamer) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/appimagebuilder/recipe/schema.py", line 111, in validate return self.v1.validate(recipe()) File "/tmp/.mount_appimaBHS1Cp/usr/lib/python3.8/site-packages/schema.py", line 400, in validate raise SchemaError([message] + x.autos, [e.format(data) if e else None] + x.errors) schema.SchemaError: Key 'AppDir' error: Key 'apt' error: Key 'exclude' error: None should be instance of 'list'

azubieta commented 2 years ago

I'll setup a debian 11 docker and test packing the project you mentioned. Regarding your handcrafted recipe, you need to write the exclude list as follows exclude: [] otherwise the validation will fail.

padsp-64 commented 2 years ago

you need to write the exclude list as follows exclude: [] otherwise the validation will fail

Thanks! After that, the download and unpacking of the packages went. However, there are still problems:

After unpacking all the packages, when trying to create an AppImage, Python errors appear. They are here:

Traceback (most recent call last):
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1007, in _send_output
    self.send(msg)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 947, in send
    self.connect()
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/transport/unixconn.py", line 30, in connect
    sock.connect(self.unix_socket)
FileNotFoundError: [Errno 2] No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
    retries = retries.increment(
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 532, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/packages/six.py", line 769, in reraise
    raise value.with_traceback(tb)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 1007, in _send_output
    self.send(msg)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/http/client.py", line 947, in send
    self.connect()
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/transport/unixconn.py", line 30, in connect
    sock.connect(self.unix_socket)
urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/api/daemon.py", line 181, in version
    return self._result(self._get(url), json=True)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/utils/decorators.py", line 46, in inner
    return f(self, *args, **kwargs)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/api/client.py", line 237, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/.mount_appimasD7Ghd//usr/bin/appimage-builder", line 8, in <module>
    sys.exit(__main__())
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/appimagebuilder/__main__.py", line 58, in __main__
    invoker.execute(commands)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/appimagebuilder/invoker.py", line 41, in execute
    command()
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/appimagebuilder/commands/run_test.py", line 31, in __call__
    test_cases = self._load_tests(self.tests_settings())
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/appimagebuilder/commands/run_test.py", line 50, in _load_tests
    test = ExecutionTest(
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/appimagebuilder/modules/test/execution_test.py", line 37, in __init__
    self.client = docker.from_env()
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/client.py", line 96, in from_env
    return cls(
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
  File "/tmp/.mount_appimasD7Ghd/usr/lib/python3.8/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

After that, I decided to build the AppImage using the appimagetool utility: ARCH=x86_64 appimagetool uget.AppDir/ --comp gzip

The package has been successfully assembled! However, on startup, the error appears again: APPRUN_ERROR: No such file or directory

Same error as with Converseen :(

I think there is something wrong with the AppRun file, and I also noticed that your AppRun is an ELF binary file, and in many builds of AppImage programs it is a shell script

azubieta commented 2 years ago

It seems that the user running appimage-builder doesn't have access to docker. Consider allowing docker usage without password or using --skip-tests