How to correctly setup Kivy in a
Saibot84 (41)

I was testing things out ... and I've found that under certain conditions ... Kivy works in a Pygame repl.

Step 1: Run the following python code
import Cython
import Cython.Distutils

(In that repl, this code is saved as setup.txt We can copy it from there to to run it)

Step 2:
Run the kivy code (but wait for kivy's wheels to be built, which take a while)

My question is ... how can we make sure that Cython and Cython.Distutils are built first ... before kivy gets built?

  • I tried using requirements.txt to require Cython and kivy ... kivy's build was throwing an error that it couldn't find Cython.Distutils
  • I tried creating a polygott repl ... and in run, having it pip install cython, then pip install kivy ... but pip was downloading the packages from the internet ... and the downloads were freezing/crashing the polygott repl container.
  • In the python code, I tried importing subprocess and using to "pip install cython" ... but this was also downloading from the internet and crashing the polygott repl container.
  • If the python code includes the line "import kivy" ... Repl is auto-installing the package ... even if I try calling subprocess to pip install cython /before/ the import kivy line of code is ever reached.

I know the Pygame and the polygott repls aren't "meant" for kivy ... but kivy is able to run.

Does anyone know how to control that cython and cython.distutils be built before kivy is built?


Edit 2020-01-04 - replaced "virtual polygott computer" with "polygott repl container"

You are viewing a single comment. View All
Saibot84 (41)

I've recently come back to the Polygott-Kivy-PreInstalled and found that it was broken / it wouldn't run /or it would crash when loading. So I've rebuilt it ... now using a script to handle installing kivy, and it only installs kivy it if it's not already installed.

When Kivy and Kivy-Garden gets built by pip3, it creates wheels in the /home/runner/.cache/pip/ subdirectories. Copying those wheels into the wheelhouse directory has now successfully bypassed/saved the whole build process and the repl should run almost immediately every time.

Edit: Other key ingredients for this were:

  • using pip3 download -d ./wheelhouse package_name_here to download the wheels locally
  • using pip3 install --no-index --find-links=./wheelhouse/ kivy to install using the local wheels

Edited 2020-01-14