Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named kivy.app

So I thought I'd toy around and try and learn Kivy, as it looks interesting. I have just started trying to get one of their examples working:

from kivy.app import App
from kivy.uix.widget import Widget

class MyPaintWidget(Widget):
    pass


class MyPaintApp(App):
        def build(self):
            return MyPaintWidget()

if __name__ == '__main__':
        MyPaintApp().run()

I get the following error:

C:\Kivy-1.8.0-py2.7-win32>python paint.py
Traceback (most recent call last):
  File "paint.py", line 1, in <module>
   from kivy.app import App
ImportError: No module named kivy.app

I have installed the latest version of Kivy. I see "app.py in the C:\Kivy-1.8.0-py2.7-win32\kivy\kivy folder.

Also, here is my PYTHONPATH:

>>> import sys
>>> for n in sys.path:
...     print n
...

C:\Kivy-1.8.0-py2.7-win32\Python27\lib\site-packages\setuptools-2.0.1-py2.7.egg
C:\Kivy-1.8.0-py2.7-win32\Python27\lib\site-packages\pywin32-218-py2.7-win32.egg

C:\Kivy-1.8.0-py2.7-win32\Python27\lib\site-packages\plyer-1.1.2-py2.7.egg
C:\Kivy-1.8.0-py2.7-win32\Python27\lib\site-packages\kivy_garden-0.1.1-py2.7.egg

C:\Kivy-1.8.0-py2.7-win32\Python27\lib\site-packages\requests-2.2.1-py2.7.egg
C:\Kivy-1.8.0-py2.7-win32\Python27\python27.zip
C:\Kivy-1.8.0-py2.7-win32\Python27\DLLs
C:\Kivy-1.8.0-py2.7-win32\Python27\lib
C:\Kivy-1.8.0-py2.7-win32\Python27\lib\plat-win
C:\Kivy-1.8.0-py2.7-win32\Python27\lib\lib-tk
C:\Kivy-1.8.0-py2.7-win32\Python27
C:\Kivy-1.8.0-py2.7-win32\Python27\lib\site-packages

Any help would be greatly appreciated. Thank you.

like image 337
Phyziks Avatar asked Dec 08 '22 04:12

Phyziks


1 Answers

I ran into this error message when I named the script kivy.py, because python looks first in the current directory to fill the dependency, so it never sees the real kivy package.

Renaming the script fixed it for me.

like image 163
Riet Avatar answered Apr 26 '23 19:04

Riet