2

everything was working fine on my ubuntu machine and suddenly i can't import App from kivy.app

from kivy.app import App  

enter image description here

red5pider
  • 351
  • 1
  • 9
  • 24

3 Answers3

6

enter image description here

One of Kivy's internal module weakmethod.py is trying to import another internal module new.py. But you have create a new.py next to where you run python, so Python will try to load yours first. This breaks everything because weakmethod doesn't expect that your new.py, it wants the internal new.py!. The solution is to rename this offending file.

(The actual problem causing ImportError is circular import on the kivy.app module)

Community
  • 1
  • 1
kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
1

For me, the import error "cannot import name app" was syntax. I replaced app with App and that solved my problem. I was able to re-create, and resolve the issue, by changing the case from lower to upper and vise versa.

Ric413
  • 11
  • 1
0

Follow this procedure:

  1. Go to kivy website

  2. Go to -> download -> Windows 7, 8, 10 (32/64 bit) Install using pip, follow the instructions here -> installation for Windows

  3. Copy and pasted in CMD->python -m pip install kivy_examples --> (The examples are installed in the share directory under the root directory where python is installed)

  4. For example C:\Python34\share\kivy-examples\animation

  5. Save all your files in this folder.

gre_gor
  • 6,669
  • 9
  • 47
  • 52