Kivy: ImportError: no module named app

I just installed Kivy by following the steps given in the official documentation.

So, I tried to check if this works by following the example specified in the official documentation:

import kivy from kivy.app import App from kivy.uix.label import Label class MyApp(App): def build(self): return Label(text='Hello world') if __name__ == '__main__': MyApp().run() 

However, I got this error:

 begueradj@begueradj-hacker:~# python kivy.py Traceback (most recent call last): File "kivy.py", line 1, in <module> import kivy File "/root/kivy.py", line 3, in <module> from kivy.app import App ImportError: No module named app 

Installation went fine, so why is this a problem?

+8
source share
1 answer

You named your file kivy.py Rename it to another. You are not importing a kivy package from your file. Remember to delete any .pyc file as well.

+19
source share

All Articles