AppImageCommunity / pkg2appimage

Tool and recipes to convert existing deb packages to AppImage
http://appimage.org
MIT License
684 stars 209 forks source link

Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding #519

Open mhsabbagh opened 2 years ago

mhsabbagh commented 2 years ago

Hello.

I am trying to package my application at https://github.com/fosspost/fp-collapse-monitor as an AppImage. I am using pkg2appimage over a local DEB file. This is my simple yml file:

app: fp-collapse-monitor
union: true

ingredients:
  dist: focal
  debs:
    - /home/mhsabbagh/Documents/fp-collapse-monitor_1.0_all.deb

However, after generating the AppImage file, I get the following error when trying to run it:

qt5ct: using qt5ct plugin
Python path configuration:
  PYTHONHOME = '/tmp/.mount_FOSS_PWWFtbU/usr/'
  PYTHONPATH = '/tmp/.mount_FOSS_PWWFtbU/usr/share/pyshared/:'
  program name = '/usr/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python'
  sys.base_prefix = '/tmp/.mount_FOSS_PWWFtbU/usr'
  sys.base_exec_prefix = '/tmp/.mount_FOSS_PWWFtbU/usr'
  sys.executable = '/usr/bin/python'
  sys.prefix = '/tmp/.mount_FOSS_PWWFtbU/usr'
  sys.exec_prefix = '/tmp/.mount_FOSS_PWWFtbU/usr'
  sys.path = [
    '/tmp/.mount_FOSS_PWWFtbU/usr/share/pyshared/',
    '',
    '/tmp/.mount_FOSS_PWWFtbU/usr/lib/python38.zip',
    '/tmp/.mount_FOSS_PWWFtbU/usr/lib/python3.8',
    '/tmp/.mount_FOSS_PWWFtbU/usr/lib/python3.8/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fe3c01efc00 (most recent call first):
<no Python frame>

Attached is the DEB file too if you would like to see it (I had to compress it in ZIP for GitHub to accept it).

What could be the issue here?

Thanks.

fp-collapse-monitor_1.0_all.zip .

probonopd commented 2 years ago

Hello, you need to put https:// or http:// URLs into debs:, not a file on the local machine. This is because recipes need to work on multiple machines without having any required additional files locally.

mhsabbagh commented 2 years ago

Are you sure about that? The documentation clearly mention that you can use a local DEB file and they give a local path: https://docs.appimage.org/packaging-guide/converting-binary-packages/pkg2appimage.html#using-local-deb-files

I tried what you did and that gave me:

+ cp http://fosspost.org/fp-collapse-monitor_1.0_all.deb .
cp: cannot stat 'http://fosspost.org/fp-collapse-monitor_1.0_all.deb': No such file or directory

This is the YML file:

app: fp-collapse-monitor
union: true

ingredients:
  dist: focal
  debs:
    - https://fosspost.org/fp-collapse-monitor_1.0_all.deb
probonopd commented 1 year ago

Are you sure about that? The documentation clearly mention that you can use a local DEB file and they give a local path

Sorry I was wrong. It's been quite a while ;-)

In any case, pkg2appimage is meant as a last-resort tool to for end user to build their own AppImages for applications that are not provided by their authors in AppImage format. For application authors, there are way better suited tools, especially for Python:

https://github.com/AppImageCommunity/awesome-appimage#deployment-tools-for-python-applications