Need help with PyCharm en Kivy on OSX (almost works)

861 views
Skip to first unread message

Marcel Maré

unread,
Mar 13, 2013, 10:16:19 AM3/13/13
to kivy-...@googlegroups.com
It seems that PyCharm & Kivy work on Windows (https://groups.google.com/forum/#!searchin/kivy-users/pycharm/kivy-users/avoM81uLK0I/Dd500kxxbr0J). Unfortunately the same cannot be quite said off OSX.

I tried to mimic the behavior of the Kivy.app: it contains a script called "script" (/Applications/Kivy.app/Contents/Resources/script) which sets a few environment variables and then calls the system python with the application's main.py. So what I did in PyCharm:


Set global environement variables. This cannot be done in .bash_profile since PyCharm runs programs directly not in a shell. This means that env vars set in the bash_profile are ignored. The only option is to set them in /etc/launchd.conf. I know that I can set ewnv vars in the project, but that would mean entering them for each and every Kivy project. Launchctl does not use variable expansion, so one needs to use full env vars.
So /etc/launchd.conf contains:

setenv KIVY /Applications/Kivy.app/Contents/Resources
setenv LD_PRELOAD_PATH /Applications/Kivy.app/Contents/Resources/lib
setenv GST_PLUGIN_PATH /Applications/Kivy.app/Contents/Resources/lib/gst-plugins
setenv GST_PLUGIN_SCANNER /Applications/Kivy.app/Contents/Resources/lib/bin/gst-plugin-scanner
setenv GST_REGISTRY_FORK "no"

rebooted and verified that the vars are loaded correctly.

Then in PyCharm:
  • Create a new project 
  • Copied the a Kivy demo app kivycatalog files to this folder
  • Created a virtualenv 'kivyenv' based on the system python interpreter (2.7.2)
  • Added 
    • /Applications/Kivy.app/Contents/Resources/kivy
    • /Applications/Kivy.app/Contents/Resources/lib/sitepackages
to the virtualenv's Paths to put them on the PYTHONPATH.
  • Set this virtualenv as the project python interpreter
  • Run main.py

With the TouchTracer demo app and some other apps this seems to work! But with the demo apps KivyCatalog, RST_editor, audio it doesn't.
I get these errors:

[DEBUG  ] [Atlas       ] Load </Applications/Kivy.app/Contents/Resources/kivy/kivy/data/../data/images/defaulttheme.atlas>
[DEBUG  ] [Atlas       ] Need to load 1 images
[DEBUG  ] [Atlas       ] Load </Applications/Kivy.app/Contents/Resources/kivy/kivy/data/../data/images/defaulttheme-0.png>
[DEBUG  ] [ImageImageIO] Load </Applications/Kivy.app/Contents/Resources/kivy/kivy/data/../data/images/defaulttheme-0.png>
arch: /Applications/Kivy.app/Contents/Resources/lib/bin/gst-plugin-scanner isn't executable

Process finished with exit code 137

In camera_puzzle I get:

[DEBUG  ] [Cache       ] register <kv.loader> with limit=500, timeout=60s
[INFO   ] [Loader      ] using a thread pool of 2 workers
Fatal Python error: (pygame parachute) Segmentation Fault

Process finished with exit code 134


So I'm progressing with Kivy+PyCharm but not quite there. Any ideas?


The second problem I have is that the approach outlined above seems to work more or less, I'd prefer to use the source version of Kivy with Homebrew installed python + other Kivy dependencies. I failed miserably. Has somebody tried the same?

Thanks all!

Marcel




Beth Null

unread,
May 20, 2013, 3:54:09 PM5/20/13
to kivy-...@googlegroups.com
Any progress?

"Marcel J. Maré"

unread,
May 20, 2013, 4:06:08 PM5/20/13
to kivy-...@googlegroups.com
I haven't retried recently. Sorry.

Marcel 


--
You received this message because you are subscribed to a topic in the Google Groups "Kivy users support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kivy-users/ylwkXl5Ba2w/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to kivy-users+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Joel

unread,
Jun 7, 2013, 3:26:20 PM6/7/13
to kivy-...@googlegroups.com
I had Kivy working in PyCharm, except like you, it wouldn't run anything based on GStreamer (like RST_Document). This was w/o jumping thru any hoops really, except to point the system at kivy instead of python.

However, after I upgraded to Kivy 1.7, it no longer works. I don't understand why at all, it seems to have proper pathing, but it errors saying it can't import pygame.macosx now. :(

J

Joel

unread,
Jun 7, 2013, 3:31:47 PM6/7/13
to kivy-...@googlegroups.com
Okay, got it. For some reason turning *off* adding content/source roots to PYTHONPATH in the runtime config fixed it.
Reply all
Reply to author
Forward
0 new messages