1

I am developing a Kivy app using VSCode on Win10. Everything is working perfectly.

To deploy my app to Android I want to use buildozer which only runs on Linux. I have turned on WSL2 and installed Ubuntu. Everything is working perfectly.

I have created a completely separate deployment environment in Linux to complement my Windows development environment. I use virtual environments in both cases. Everything is working.

When I run my app in the Windows environment, it works. When I run it in the Linux environment, it fails. After searching around, I believe the problem has to do with windowing. Kivy wants to open a window, but my Ubuntu is not set up for that.

By the way, I do not know much about Linux.

Here is the code and messages.

Sample Code

from kivy.app import App
from kivy.uix.label import Label

class Play(App):

    def build(self):
        l = Label(text="Hello World")
        return l

if __name__ == '__main__':
    Play().run()

Error Messages

 /usr/bin/env /mnt/c/Users/mark/OneDrive/dev/babyclix_stg/.venv/bin/python /home/mkortink/.vscode-server/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/launcher 65502 -- /mnt/c/Users/mark/OneDrive/dev/babyclix_stg/hello.py 
mkortink@DESKTOP-6FAUQ4D:/mnt/c/Users/mark/OneDrive/dev/babyclix_stg$  /usr/bin/env /mnt/c/Users/mark/OneDrive/dev/babyclix_stg/.venv/bin/python /home/mkortink/.vscode-server/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/launcher 65502 -- /mnt/c/Users/mark/OneDrive/dev/babyclix_stg/hello.py 
source /mnt/c/Users/mark/OneDrive/dev/babyclix_stg/.venv/bin/activate
[INFO   ] [Logger      ] Record log in /home/mkortink/.kivy/logs/kivy_20-10-16_3.txt
[INFO   ] [Kivy        ] v1.11.1
[INFO   ] [Kivy        ] Installed at "/mnt/c/Users/mark/OneDrive/dev/babyclix_stg/.venv/lib/python3.7/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.7.9 (default, Aug 18 2020, 02:07:21) 
[GCC 9.3.0]
[INFO   ] [Python      ] Interpreter at "/mnt/c/Users/mark/OneDrive/dev/babyclix_stg/.venv/bin/python"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [Window      ] Provider: x11(['window_egl_rpi', 'window_sdl2'] ignored)
Couldn't connect to X server

Can someone please tell me what I need to do to Ubuntu to get Kivy working. Alternatively, I am quite happy to give Ubuntu the flick and install a more beginner friendly Linux distro that is more Windows-like and comes with things like window managers preinstalled.

Thanks

1 Answer 1

1

Can someone please tell me what I need to do to Ubuntu to get Kivy working.

You need to install and set up an X server.

I'm not clear, why do you actually need/want to do this? Why not use windows for gui development and the Ubuntu environment for the packaging?

I am quite happy to give Ubuntu the flick and install a more beginner friendly Linux distro that is more Windows-like and comes with things like window managers preinstalled.

Ubuntu is precisely that type of beginner friendly distro. The reason you don't have gui support out of the box is that WSL2 isn't set up for it, not that Ubuntu is doing anything wrong, although I understand WSL2 is moving in the direction of having some builtin wayland support.

1
  • That's a good question, in my deployment/packaging environment I was thinking I should verify the app runs as a last check before packaging it all up. There is some mechanical prep work required before packaging, but I could do that in the dev environment and just use Ubuntu for packaging :) Commented Oct 16, 2020 at 21:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.