Use Kivy within Intellij IDEA + Python plugin / Pycharm

921 views
Skip to first unread message

Lúthien Merilin

unread,
Jun 28, 2015, 7:37:06 AM6/28/15
to kivy-...@googlegroups.com
Hi,

I'm trying to set up a development environment using Python 2.7.6. and Kivy 1.9 (rev 3) on Intellij IDEA with the Python plugin (which should give it all the PyCharm functionality) on osx 10.10.3.

Installing Kivy itself is fine: I can drag any of the shipped examples to Kivy and it runs.

However, I want to use it within IntelliJ  / Pycharm, and here I'm hitting a problem because I need to setup a Python SDK environment within IntelliJ, which should point to the Python environment that ships with Kivy.
The problem is this: the IDE gives me a file dialog with which I'm supposed to navigate to the intended location ... but I cannot get inside the Kivy.app with it.

I can neither enter a directory manually (ie. /Applications/Kivy.app/); and creating a symlink or a hard link to either /Applications/Kivy.app/Contents/Resources/script or /Applications/Kivy.app/Contents/Resources/venv/bin/python aren't accepted as valid Python environments.

The last thing that I tried was to extract the entire Kivy.app contents from its .app directory so that it turns in to a regular directory and is accessible. Then the environment is accepted, code completion works - but running scripts becomes impossible, *including* running them using the original Kivy.app as I could before, resulting in an endless avalance of

 Traceback (most recent call last):
 Traceback (most recent call last):
  Traceback (most recent call last):
 [WARNING           ] [stderr      ] Traceback (most recent call last):
... ... (etcetera)

messages in the Intellij output - or even on the command line after entering the kivy / python shell and entering "import kivy".

Said otherwise: I'm pretty much stuck.
I have the impression that the way that Kivy is packaged is a bit unusual anyhow: with regular user-accessible contents hidden inside Kivy.app - as opposed to a location where it can be easily reached, such as in the ~/Library or what have you - as is standard practice.

Of course I understand that it's all volunteer work and really, I don't mind at all if I would be able to get it to work some way or another - I got interested in Kivy because it looks like a great tool.

Does anyone have a suggestion how I can set Kivy up so that it can be used as a valid Python SDK from within IntelliJ / Pycharm?

Kived Devik

unread,
Jun 28, 2015, 12:21:22 PM6/28/15
to kivy-...@googlegroups.com
I haven't tried with IDEA and the Python plugin, but PyCharm 4.5 worked almost perfectly following the directions on the wiki: https://github.com/kivy/kivy/wiki/Setting-Up-Kivy-with-various-popular-IDE's#setting-up-kivy-190-with-pycharm-45-eap-on-os-x-10103

The only issue I had was that it didn't seem to work right if I actually did it with no project open. After opening a project, I was able to get it working by setting up the interpreter in the Default Project settings, then editing the Project settings and switching to the interpreter that I had defined in defaults.

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lúthien Merilin

unread,
Jun 28, 2015, 3:08:09 PM6/28/15
to kivy-...@googlegroups.com
Hello Ryan,

indeed, I have also followed the instructions on that page. The problem is that with IDEA + plugin, I cannot do this step:
  • In the Select Python Interpreter window, delete the path of the currently selected python interpreter (in my case, this was /usr/bin/python) and navigate to (or copy that path into the address bar):

/Applications/Kivy.app/Contents/Resources/python
... because the file chooser doesn't let me navigate inside the .app package.
Or so I thought. I searched again just now and found this page where it is explained that you can choose "show package contents" in another Finder window, and simply drag & drop the file you need from inside the package onto the filechooser dialogue.
I tried that in IDEA and to my delight it worked! Goes to show that after 8 years of using OSX one can still learn a new trick :) - after all my hassling with aliases, soft and hard links I must admit that I had not thought of this at all.
Reply all
Reply to author
Forward
0 new messages