kivy: ImportError: No module named app

16,278

You named your file kivy.py. Rename it to something else. You are importing from your file not the kivy package. Make sure to delete any .pyc file also.

Share:
16,278
Admin
Author by

Admin

Updated on June 16, 2022

Comments

  • Admin
    Admin almost 2 years

    I just installed Kivy by following the steps mentioned on the official documentation.

    So I tried to test if it works by running an example found on 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 ok, so why is this problem ?

  • howMuchCheeseIsTooMuchCheese
    howMuchCheeseIsTooMuchCheese about 8 years
    you also can't name the file run.py
  • Beez
    Beez over 5 years
    haha. Did the same thing. Didn't even think about that!