when i run this simple code of kivy , get this error

244 views
Skip to first unread message

sohei...@outlook.com

unread,
Aug 15, 2018, 10:07:17 AM8/15/18
to Kivy users support
    : Hi guys , good time . i have a problem in python_kivy . can anyone help me? I think remove this error is simple work! but i don't know  why  i have this error.
Screenshot (6).png
my code:   {
import kivy
kivy.require('1.7.0')

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

class Hellowapp(App):

    def build(self):
        return Label(text='Hello word!')

if __name__=="__main__":
    Hellowapp().run()
    pass   }
and my error : {
[INFO   ] [Logger      ] Record log in C:\Users\SSH\.kivy\logs\kivy_18-08-15_5.txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - ImportError: DLL load failed: The specified module could not be found.
  File "C:\Users\SSH\AppData\Local\Programs\Python\Python37\Lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib
    cls = cls()
  File "C:\Users\SSH\AppData\Local\Programs\Python\Python37\Lib\site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "C:\Users\SSH\AppData\Local\Programs\Python\Python37\Lib\site-packages\kivy\core\window\__init__.py", line 968, in __init__
    self.create_window()
  File "C:\Users\SSH\AppData\Local\Programs\Python\Python37\Lib\site-packages\kivy\core\window\window_sdl2.py", line 272, in create_window
    self.fullscreen, resizable, state)
  File "kivy\core\window\_window_sdl2.pyx", line 125, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "kivy\graphics\cgl.pyx", line 52, in kivy.graphics.cgl.cgl_get_backend_name
  File "kivy\graphics\cgl.pyx", line 60, in kivy.graphics.cgl.cgl_get_backend_name
  File "C:\Users\SSH\AppData\Local\Programs\Python\Python37\Lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level: ], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 670, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 583, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 1043, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed

[CRITICAL] [App         ] Unable to get a Window, abort.

Process returned 1 (0x1)        execution time : 17.133 s
Press any key to continue . .     
}

dilshad khan

unread,
Aug 15, 2018, 10:11:13 AM8/15/18
to kivy-...@googlegroups.com
Hellowapp should be HellowApp



--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/9eb677dc-3676-4ba4-97d3-ca93fdb910d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

Ali Ansari

unread,
Aug 16, 2018, 12:01:48 AM8/16/18
to Kivy users support
"from kivy.uix.button import Label"

I think you should not import "Label" from "kivy.uix.button". And I'm sure that you need to import it like this:

from kivy.uix.label import Label

According to docs, "kivy.uix.label" is one of the bases of "from kivy.uix.button". But this doesn't mean that one could import label from button.

However, it's probably ok to do:
from kivy.uix import *

but then, you must use:
label.Label
button.Button

instead of Lable and Button.

Regards,
Ali.

sohei...@outlook.com

unread,
Aug 16, 2018, 12:19:48 AM8/16/18
to Kivy users support
I chenged that but my problem was not resolved!
Message has been deleted

Ali Ansari

unread,
Aug 16, 2018, 12:48:32 AM8/16/18
to Kivy users support
Sorry, I didn't notice the code in your screenshot. I saw the the code in the {} before the error.

anyways, I think this should solve the problem:

import os
os.environ['KIVY_GL_BACKEND'] = 'sdl2'
from kivy.core.window import Window

put it in your .py file, befor any "import" that is related to kivy.

https://github.com/kivy/kivy/issues/5348


Please let us know if this solve your problem :-)

Regards,
Ali.

sohei...@outlook.com

unread,
Aug 16, 2018, 1:25:33 AM8/16/18
to Kivy users support
ببخشید علی آقا(فکر میکنم هم وطن باشیم!)من برای اولین بار میخواستم از کیوی استفاده کنم و از یه فیلم آموزشی برای نصب کیوی و دیگر پکیج های آن از طریق سی ام دی اقدام کردم وبرای برسی کیوی این کد ساده رو نوشتم سپس به این مشکل برخورد کردم. من می خوام با محیط دیزاینری کیوی کار کنم اما این محیط هم باز نشد ؟؟
من از روی این فیلم پیش رفتم آیا راهی هست که همه چیز رو از اول شروع کنم ؟
یعنی کیوی و پکیج های اون رو حذف کنم و دوباره نصب رو انجام بدم؟(آیا با این کار مشکلم برطرف میشه ؟)
با تشکر
سهیل
 

sohei...@outlook.com

unread,
Aug 16, 2018, 1:37:39 AM8/16/18
to Kivy users support

i write that code and run but this happened:

Screenshot (8).png


Why should I write this code?



در پنجشنبه 16 اوت 2018، ساعت 9:18:32 (UTC+4:30)، Ali Ansari نوشته:

Ali Ansari

unread,
Aug 16, 2018, 1:46:35 AM8/16/18
to Kivy users support
Yes, I'm Iranian. But please write your replies in English, because it may help anybody else who is experiencing a same problem, but doesn't speak Persian necessarily.
It seems that you're using MS Windows. I, personally, think that Kivy on MS Windows is not a good idea. If you are considering Android as your target platform, it is not possible on MS windows to build an APK from kivy, not at all!
I think that it's possible to do a clean uninstall and then to install it again. In this case, I recommend you to do the new installation in a virtual env. This way, removing the virtual env would be enough to start from zero, and there will be no need to remove every directory that kivy (or buildozer, if you use it) makes in your PC.
And I highly recommend you to use a linux distro (ubuntu 16.04 is perfect for this. don't use 18.04, as it has many differences with the docs available on kivy (or buildozer).

Ali Ansari

unread,
Aug 16, 2018, 1:49:53 AM8/16/18
to Kivy users support
The 3 lines I mentioned from a github issue will set the required environment variable. since it seems that there is no window provider at your runtime, the lines could solve your problem.

Ali Ansari

unread,
Aug 16, 2018, 3:43:31 AM8/16/18
to Kivy users support
Update: As the BessageBox says, your opengl version is not the latest version. I guess the very first error was a result of this issue.

Please upgrade opengl & reinstall kivy. Here is 3 links to download different graphic drivers for MS Windows:
https://www.khronos.org/opengl/wiki/Getting_Started#Windows

Since you live in Iran like me, consider using a vpn service or changing your IP address if you are planning to download the drivers. Some brands have restricted our access due to the international sanctins.

dilshad khan

unread,
Aug 16, 2018, 5:10:51 AM8/16/18
to kivy-...@googlegroups.com
my code:   {
import kivy
kivy.require('1.7.0')

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

class Hellowapp(App):

    def build(self):
        return Label(text='Hello word!')

if __name__=="__main__":
    Hellowapp().run()
    pass   }


That's from the email you sent yesterday

On Thu, 16 Aug 2018, 04:44 , <sohei...@outlook.com> wrote:
excuese me sir Dilshad khan , but i do not have this code (Hellowapp)!!!


--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.

dilshad khan

unread,
Aug 16, 2018, 5:18:27 AM8/16/18
to kivy-...@googlegroups.com
I've just seen your latest screenshot, you've corrected it.

Also change the name of the file to main.py, that may not solve your problem but that's the conventional way to name the file that contains the App class. 

sohei...@outlook.com

unread,
Aug 18, 2018, 3:02:31 AM8/18/18
to Kivy users support
thank you very much for your help, dear compatriot.
i decided use a linux distro. Do you think my problem will be solved by this method?


در پنجشنبه 16 اوت 2018، ساعت 10:16:35 (UTC+4:30)، Ali Ansari نوشته:

sohei...@outlook.com

unread,
Aug 18, 2018, 3:10:41 AM8/18/18
to Kivy users support
Excuse me Mr. Dilshad Khan; I was wrong, you say right.


در پنجشنبه 16 اوت 2018، ساعت 13:48:27 (UTC+4:30)، dilshad khan نوشته:
Reply all
Reply to author
Forward
0 new messages