Skip to content
← Back to Community
How to correctly setup Kivy in a Repl.it
Profile icon
Saibot84

I was testing things out ... and I've found that under certain conditions ... Kivy works in a Pygame repl. https://repl.it/@Saibot84/Kivy-code-snippets

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 main.py 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 subprocess.call 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?

-Michael

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

Answered by Saibot84 [earned 5 cycles]
View Answer
Voters
Profile icon
cutebear0123
Profile icon
PaoloAmoroso
Profile icon
emotionbot
Profile icon
Saibot84
Comments
hotnewtop
Profile icon
Saibot84

I've recently come back to this ... and after some experimentation ...

https://repl.it/@Saibot84/Polygott-Kivy-Installer-Runner
Here's a polygott repl that installs kivy from a local wheelhouse, then runs the x11 vnc server and then the python code.
It will seem to hang while installing Kivy ... but you can check the nohup.out file to see the installation progress until the server and code are started. (By the way, it seems that sending output to nohup prevents the repl from crashing.)

https://repl.it/@Saibot84/Python3-Pygame-Kivy
Here's a Python3 with Pygame repl ... that uses a requirements.txt file to install kivy. Running it looks like it hangs while building Kivy, but just wait for it to finish.

https://repl.it/@Saibot84/Polygott-Kivy-PreInstalled
Here's a polygott repl that has kivy preinstalled ... so the build runs much faster. It, too, then runs the x11 vnc server and then the python code.

Profile icon
Saibot84

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 setup.py 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

https://repl.it/@Saibot84/Polygott-Kivy-PreInstalled

Edited 2020-01-14

Profile icon
Saibot84

2020-08-25
The polygott container used by Polygott-Kivy-PreInstalled is now using python 3.8 ... which is not supported by Kivy 1.11.1 and this is preventing the repl from running. I'm working on finding an alternative solution for polygott.

In the meantime, here is a Python3.8 repl (including a local copy of Kivy 2.0.0rc3) that can run the Kivy showcase Kivy-Showcase-Python38-PreInstalled

Backing up the wheels isn't necessary either if we use Kivy = "^2.0.0rc3" in pyproject.toml together with

[tool.poetry.dev-dependencies.Kivy] url = "https://kivy.org/downloads/ci/linux/kivy/Kivy-2.0.0rc3-cp38-cp38-manylinux2010_x86_64.whl"

as seen here: Python38-Kivy-200rc3

Edited 2020-08-25

Update 2020-08-27: Polygott repls are unable to show graphics. Even a simple X application fails to work. Polygott Simple Xclock Test

Profile icon
CiaraVeum

I am very glad to read this informative article. google

Profile icon
EverettPorter

They are generally filled in as a side to a meal meat and vegetable supper with sauce, however you'll see that they work out positively for basically any dish that contains earthy colored sauce. Pre-heat your broiler to 475 degrees F. Put a lubed biscuit skillet in to warm up while you set up the hitter. Beat the eggs and salt together, then, at that point, add milk and flour. Mix until smooth. At the point when your biscuit skillet is hot, remove it from the stove and empty player into each cup-about midway ought to do. Return the skillet to the broiler to prepare for a couple of moments until the puddings are brilliant brown. These ought to be the last things added to your plate and finished off with earthy colored sauce.

Profile icon
EverettPorter

They are generally filled in as a side to a meal meat and vegetable supper with sauce, however you'll see that they work out positively for basically any dish that contains earthy colored sauce. Pre-heat your broiler to 475 degrees F. Put a lubed biscuit skillet in to warm up while you set up the hitter. Beat the eggs and salt together, then, at that point, add milk and flour. Mix until smooth. At the point when your biscuit skillet is hot, remove it from the stove and empty player into each cup-about midway ought to do. Return the skillet to the broiler to prepare for a couple of moments until the puddings are brilliant brown. These ought to be the last things added to your plate and finished off with earthy colored sauce.

Profile icon
EverettPorter

Careful administrations and methodology were gone into PC programming charging frameworks and cases printed and sent to insurance agencies. Protection and patient installments got by means of mail (snail mail) were gone into similar programming project and month to month explanations, showing a patient's equilibrium, were printed and sent. https://bestdoctornearme.com/ The innovation blast from the 1980s to the present has achieved colossal changes to how we oversee data.

Profile icon
MartinCervantes

Talks and all pills are rushed for the approval of the turns for people. The theme of the https://www.bestessaytips.com/pendrago-com-review/ is assumed for the field. The value of the talk is held for the picture and tutorial for all pictures for the terms for the citizens.

Profile icon
Alt_Plus_F4

Is there a way to do this with pyglet?

Profile icon
Saibot84

Great question @Alt_Plus_F4 !

Here's an example of Pyglet running in a Polygott REPL.

By using a polygott repl, we can controlling the installation using a Makefile.

For for a faster time-to-interactive I have:

  • downloaded the wheels for pyglet and future
  • and after building the future package once, I moved the wheel file into the local directory
  • then listed the two wheel files in requirements.txt
  • and used pip3 install -r requirements.txt to install the packages from the local directory

I hope that helps.

Profile icon
Alt_Plus_F4

@Saibot84
Thanks for the reply, but I already figured out how to do it in a pygame repl, I just had to set the run command to start a polygott xn11 server.