0

I'm trying to run code from the first answer to this question.

I am getting the following error trying to import behaviors from the kivy garden:

 Traceback (most recent call last):
   File "fromSO.py", line 3, in <module>
     from kivy.garden.geartick import GearTick
   File "/usr/lib/python2.7/dist-packages/kivy/garden.py", line 81, in load_module
     return self._load_module(fullname, moddir)
   File "/usr/lib/python2.7/dist-packages/kivy/garden.py", line 85, in _load_module
     ('', '', imp.PKG_DIRECTORY))
   File "/home/username/.kivy/garden/garden.geartick/__init__.py", line 1, in <module>
     from geartick import GearTick
   File "/home/username/.kivy/garden/garden.geartick/geartick.py", line 2, in <module>
     from kivy.uix.behaviors import ButtonBehavior
 ImportError: No module named behaviors

I have done:

$ pip install kivy-garden
$ garden install geartick
$ cd
$ cd kivy
$ git pull kivy
$ python setup.py build_ext --inplace -f
$ make

Any ideas on what's wrong?

Community
  • 1
  • 1
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
  • Which version of Kivy do you use? Behaviours are new in 1.8.0 as you can see in documentation: http://kivy.org/docs/api-kivy.uix.behaviors.html – Nykakin Dec 14 '13 at 00:37

1 Answers1

1

Make sure you remove all previous installations of kivy...

pip uninstall kivy
sudo apt-get remove python-kivy

To be sure kivy is uninstalled run the following command

python -c "import kivy"

If you get a line like::

[INFO   ] Kivy v1.x.x...

Then you still have kivy installed somewhere and need to figure out where it is installed and uninstall it.

Next Install latest kivy(1.8) from github

cd /Where/You/Want/Kivy
git clone http://github.com/kivy/kivy
make
export PYTHONPATH=/path/to/kivy/clone

To check if kivy is setup and working ::

python -c "import kivy"

Should give you

[INFO   ] Kivy v1.8.0-dev

Or wait a few days 1.8 is due to be released in a couple of days

qua-non
  • 4,152
  • 1
  • 21
  • 25
  • Hmm, I ran all of that and it looked successful, but now the error I get is: `from kivy.app import App ImportError: No module named kivy.app` and the parts of kivy that used to work are broken. – Mittenchops Dec 14 '13 at 20:05
  • Oh, I missed the path export. That took care of it. Thanks. – Mittenchops Dec 14 '13 at 20:06
  • Do people usually make the export path permanent? Or how do you deal with that? I rebooted and it doesn't work anymore. I understand it's not hard to make that permanent, but wonder if that's the normal practice. – Mittenchops Dec 14 '13 at 21:31
  • for development purposes it's easier to just add it to your PYTHONPATH rather than install it this way you can different version of kivy available and just set the appropriate path (or you could use virtualenv). If you want to set the path permanently just add it to your ~/.bashrc – qua-non Dec 15 '13 at 00:52