0

I installed kivy and pygame to python and tried to run this:

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


class MyApp(App):
    def build(self):
        return Label(text="fcguh")


if __name__ == "__main__":
    MyApp().run()

It displayed an error message saying "No module named 'kivy'".

Then I tried to find the solutions on the Internet and did something I can't recall and the error message became like this:

[INFO   ] [Logger      ] Record log in C:\Users\dekmeymey\.kivy\logs\kivy_19-06-12_4.txt 
[INFO   ] [Kivy      ] v1.11.0 
[INFO   ] [Kivy        ] Installed at "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\__init__.py" 
[INFO   ] [Python      ] v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] 
[INFO   ] [Python      ] Interpreter at "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\pythonw.exe" [INFO   ] [Factory     ] 184 symbols loaded 
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif (img_sdl2, img_pil, img_ffpyplayer ignored) 
[CRITICAL] [Text        ] Unable to find any valuable Text provider. 
Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes sdl2 - ImportError: DLL load failed: The specified module could not be found.   File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
            fromlist=[modulename], level=0)   File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\text\text_sdl2.py", line 13, in <module>
            from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,

        pil - ModuleNotFoundError: No module named 'PIL'   File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\__init__.py", line 63, in core_select_lib
            fromlist=[modulename], level=0)   File "C:\Users\dekmeymey\AppData\Local\Programs\Python\Python37\lib\site-packages\kivy\core\text\text_pil.py", line 7, in <module>
            from PIL import Image, ImageFont, ImageDraw

[CRITICAL] [App         ] Unable to get a Text provider, abort. 

I tried installing kivy again in case if I missed anything but nothing changes. Can anybody help? I have a school project to complete.

Edit: Before I was able to install my kivy, my pip doesn't work either. I tried countless ways on the Internet for the solution, but I just uninstalled and reinstalled back python to get it to work.

I found the answer!!

I copied this into the command prompt

bitsadmin /transfer "GetBatch" "https://git.io/vDDjn" "%cd%\python\kivy.bat"
cd python

and then searched kivy in C:. After that, I copied my pyhton file and put it into the kivy folder. Run it, and it worked!!

eyllanesc
  • 235,170
  • 19
  • 170
  • 241

2 Answers2

0

You need to add that directory to the path:

import sys
sys.path.append('../kivy')

Maybe put this into a module if you are using it a lot.

Kais Tounsi
  • 11
  • 4
  • 8
0

Funny thing: when I edited your question (imports at the beginning), it wouldn't let me save the edit because of the title :"Kivy not working" (it had to be changed). I find that more than OK, since Kivy is working, the problem is on your side. What I don't understand is: why that title was allowed in the first place.

The error stands out:

pil - ModuleNotFoundError: No module named 'PIL'

This is quite common. Pillow (formerly known as PIL), is one of Kivy's dependencies.

Check [Kivy]: Installation on Windows - Installing the kivy stable release, for more details, paying attention to the python -m pip install ... steps.
One of them will install Pillow - or if that doesn't happen (although it shouldn't), install it manually: python -m pip install pillow (might apply to other packages as well).

CristiFati
  • 38,250
  • 9
  • 50
  • 87