I'm having trouble getting Kivy to work with PyCharm on Windows 7. I've managed to add most of the external libraries through File > Settings > Python interpreters > Paths Tab.
I'm using the Kivy version of Python. When I run a Kivy app that works fine with using the [right click > send to > kivy.bat] method in PyCharm, it gives me this error:
Failed modules
Python 2.7.3 (C:/Python27/python.exe)
_imagingtk
dde
gtk._gtk
pangocairo
Generation of skeletons for the modules above will be tried again when the modules are updated or a new version of generator is available
I think that the problem might be something to do with cython, as my file fails to recognise the kivy.properties file, which is of the Cython *.pxd format.
Install and open PyCharm
File -> Settings (Ctrl + Alt + S)
. (If not, create a new project, and click the '...
' (or ) next to interpreter, and skip step 2)Project Interpreter -> Python Interpreters
..\Kivy\Python\python.exe
and click ok (my path was c:\Program files (x86)\Kivy\Python\python.exe
since that is where I unzipped the kivy zip file to)I have also attached a settings.jar file. This is the kv
language definition. It is not complete, but it helps a lot.
Click File->Import
and select the settings.jar
file.
Only FileTypes will be ticked. Import this and you will have "kv language file
" definition under File->Settings-IDE Settings->File Types
Open a kv
file to see the differentiation in colours, as well as autocomplete
That is all for PyCharm, the rest is Windows 7 specific
..\Kivy\Python\lib
foldermklink /D kivy "..\Kivy\kivy\kivy"
(my line was mklink /D kivy "c:\Program files (x86)\Kivy\kivy\kivy"
)
This will set up a symlink so that your all your kivy python files are read and their definitions are included, in order to get autocompleteNow we need to set up the environment variables. You could do this per project inside PyCharm, but might as well do it in windows, so you only need to select the python interpreter each time.
Click start and type envir Select the second one. (System variables) (You could also get here with Win+PauseBreak
-> Click Advanced system settings
)
Click Environment variables
Now add these (once again, just point to wherever you have your kivy
folder. You can also find all these in the kivy.bat
file, just find and replace the variables with your path)
GST_PLUGIN_PATH
c:\Program Files (x86)\Kivy\gstreamer\lib\gstreamer-0.10
GST_REGISTRY
c:\Program Files (x86)\Kivy\gstreamer\registry.bin
PATH
c:\Program Files (x86)\Kivy;c:\Program Files (x86)\Kivy\Python;c:\Program Files (x86)\Kivy\gstreamer\bin;c:\Program Files (x86)\Kivy\MinGW\bin;c:\Program Files (x86)\Kivy\kivy;%PATH
Restart your machine. (For the environment variables to load)
Now when you open your kivy project, just select the Kivy interpreter you set up earlier, and bobs your uncle.