Kivy on OSX

How do I set up to run Kivy on OSX with PyCharm? I've seen instructions for Windows, but not for OSX.
0
10 comments
I couldn't point the environment to "kivy", but I changed an existing one to point to /usr/local/bin/kivy. This allows me to run the "hello world" kivy app. I'm guessing there is more to setup though for other libraries, etc.
0
As it stands, I get red underlines on this line:
from kivy.properties import NumericProperty, ReferenceListProperty
0
Here's what I did:

1:  Preferences > Project Interpreter > Python Interpreters

Create a virtualenv. I couldn't figure out how to make it directly, so I made on from 2.7.1 and then edited it. I tried navigating to /usr/local/bin/kivy when I needed to choose the interpreter, but it didn't work.

Edit Python Interpreter
Name: Kivy
Interpreter Path: /usr/local/bin/kivy  

It doesn't really matter what you name it. It just matters that you know which virtualenv is where.

Kivy is already its own virtualenv/custom python distribution (type the kivy cmd in a terminal, it's a python shell), so pycharm needs to look at /usr/local/bin/kivy instead of /Library/Frameworks/Python.framework/Versions/Current/bin/python (or whatever) for code inspections, libraries, eggs, etc.  

Note that you must have run the make-symlinks script that came with the Kivy.app installer for this to work. If you didn't/can't run make-symlinks, try changing the path to kivy to /Applications/Kivy.app/Contents/Resources/script  

2: Make sure Kivy is your project interpreter

After you create the kivy interpreter, set it as your kivy project interpreter in Preferences > Project Interpreter.

Apply and Ok, and confirm that the skeletons generate (or at least mostly, I had some errors) and that your project looks a bit like this:

Screen Shot 2013-04-15 at 1.02.53 PM.png


Note that my python system library is horribly polluted, so if yours is clean it will look different.

3: Add .kv support

You can save Kivy Files.xml (949B) to this directory: ~/Library/Preferences/PyCharm20/filetypes/

I made it pretty quickly, it's missing a lot but at least it will color a lot of the main words.

4: Add a Run Config

Make a run config like normal, just make sure the Kivy interpter is selected so that pycharm will use /usr/local/bin/kivy instead of your standard python (/usr/bin/python or whatever)




Caveat Emptor: I just started the kivy tutorials myself, so I can't promose I did that totally correctly but it seems to work...
0
has any progress been made on this?  I am able to add Kivy as an interpreter, but I'm not sure that it's working, as I also have redlines under

from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty


it would be great to be able to work on Kivy apps in PyCharm!
0
I'm also in the same situation as guest 06/04/13. Would be great to have support for kivy packages (so red underlining goes away and integrated source navigation etc), also would be great to support debugging experience with kivy apps.

I was able to create a tool in which manually launch my app easily (by going to Settings>External Tools and setting 1) Program to /usr/local/bin/kivy 2) Parameters to: path to my main.py file relative from 3) and 3) Working Directory... my complete working directory.)

It's sort of a stop gap... but, far short of what is required.
0
Avatar
Random PyCharm and TeamCity User
Please "vote" for PY-8238 if you'd like to see improved PyCharm support for Kivy.  I know I would!

http://youtrack.jetbrains.com/issue/PY-8238
0
I followed the steps stated by Peter but still cannot successfully set project interpreter to Kivy 1.8. It prompted an error message "Invalid python interpreter name{0}!". I upgraded to pycharm 3.4 recently. What have I done wrong?
0
I finally success! I found I missing the steps on creating virtualenv by Python 2.7 first and then edit it.
0
I'm on a Mac, running 10.7.  So far no luck getting pyCharm to run Kivy with the instructions here.

I'm getting the error...

/usr/local/bin/kivy /Users/user/Downloads/Cython-0.20.2/setupegg.py
Traceback (most recent call last):
  File "/Users/user/Downloads/Cython-0.20.2/setupegg.py", line 4, in <module>
    execfile('setup.py')
  File "setup.py", line 25
    ImportError: No module named kivy.app
^
SyntaxError: invalid syntax

Process finished with exit code 1

Does anyone have a fix?

P.S. Kivy scripts run if I open them with Kivy.app.
0

Please sign in to leave a comment.