Help Needed: Packaging TouchRacer with new OSX Method does not works

108 views
Skip to first unread message

OPQ

unread,
Nov 17, 2015, 4:22:07 PM11/17/15
to Kivy users support
I tried packaging the touchracer example with new official method describe in http://kivy.org/docs/guide/packaging-macosx.html
After the app is created & launched, I can see a touchracer app in the Activity Monitor, but no screen is started. 


Any ideas ? 

Mac OSX last version El Capitan with Kivy 1.9

I really need to figure out this packaging process in order to deploy my app. 

Thanks !

--OPQ

ZenCODE

unread,
Nov 19, 2015, 1:55:13 AM11/19/15
to Kivy users support
Is that an app you created, or do you mean 'touchtracer'? Did the mis-naming not perhaps cause a problem?

OPQ

unread,
Nov 19, 2015, 7:48:32 AM11/19/15
to Kivy users support
I first tried with an app I created, which did not work. 
Thinking it was because of my app, I tried packaging the TouchRacer Application which can be found in standard Kivy examples/demo folder, as I know it is a good candidate for packaging test.

Same result happens as for my own app: I created a .app, which I can run (double click), which appears in process list, but does not start any windows whatsoever. It it just like it misses a basic bootstrap. 

Ben Hagen

unread,
Nov 19, 2015, 12:13:28 PM11/19/15
to Kivy users support
Its hard to tell what went wrong without the output of your app. Try running it from the commandline.

Some general info:

There are different ways of using Kivy on OS X right now.
  1. Kivy.app bundle
    • Dependencies already built in
    • Modules installed via kivy -m pip install mymodule
  2. Kivy installed via pip
    1. Dependencies installed by hand and modules installed vial pip install mymodule
      • modules installed via pip install mymodule
    2. Dependencies installed via Homebrew and modules installed via pip install mymodule
      • modules installed via pip install mymodule

To package your app you also have multiple options:
  1. kivy-sdk-packager (currently documented as the official way) 
    • uses the Kivy.app
  2. PyInstaller 3
    1. using the dependencies installed in the Kivy.app
    2. using the dependencies installed by hand
    3. using the dependencies installed via Homebrew

I am currently working improving the documentation of all of those ways. Until the problems of our documentation server are solved please read the latest documentation at https://github.com/kivy/kivy/blob/master/doc/sources/guide/packaging-osx.rst as the other version might be outdated.

I hope to update the packaging documentation tonight. As i am more familiar with the PyInstaller versions i would recommend to install PyInstaller from my pull request https://github.com/pyinstaller/pyinstaller/pull/1678 already and try adapting the PyInstaller version.

Some preview:

For PyInstaller + Kivy.app dependencies:
  • kivy pyinstaller.py --windowed --name touchtracer ../kivy/examples/demo/touchtracer/main.py
For PyInstaller + dependencies by hand / homebrew
  • pyinstaller --windowed --name touchtracer ../kivy/examples/demo/touchtracer/main.py
In the case of homebrew make sure you install all dependencies that do not come in a bottle with "--build-bottle". So for example:
  • brew reinstall --build-bottle sdl2_ttf
Also keep in mind that you build your dependencies on the oldest OS X version that you want to support!

Sorry i have to hurry to a meeting now. Please try different options and meet me in the irc channel later if you need more help. Or just wait and find a nice documentation in the very near future online.

Greetings
Ben

qua non

unread,
Nov 19, 2015, 1:02:06 PM11/19/15
to kivy-...@googlegroups.com
@OPQ run your app from a terminal using path/to/yourapp.app/contents/Resources/script you should see the reason for failure on the command line. Could you please paste the output.


Most usually the reason for failure with the .app method is if you compiled kivy in the kivy.app yourself.
The kivy in the kivy.app we provide is setup using the kivy-sdk-packager, which does a bit more than just compiling.

Paste the log of the output from the script and we will get to see the real reason for failure.


--
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.

Ben Hagen

unread,
Nov 20, 2015, 6:31:02 PM11/20/15
to Kivy users support
You can find the improved but still somewhat unpolished version of the documentation at:

OPQ

unread,
Nov 21, 2015, 9:18:26 AM11/21/15
to Kivy users support
Ok, so I tried the kivy-sdk method, excaxtly copying everything from this link (even the uppercase A from Kivy.App in the line "cp -a /Applications/Kivy.app/ ./Kivy.App"

touchracer.app is created.
When double cliked, nothing happens. A process is created, which take 0% CPU. 
When launched from command line ("open touchracer.app"), there seems to be 30 sec of processing before the prompt is given back to me. But not windows is launched.

Also note that I directly went to Security parameters of the MAC to allow for untrusted Developpers. 

Then, I went in creating the dmg, just in case. It did not work with a 'not enough space on the device error'. 
Of course, there is still space on my hard drive. Here is the complete log: 

pq$ ./create-osx-dmg.sh touchtracer.app/

++ basename touchtracer.app/ .app

+ APP_NAME=touchtracer

+ DMG_BACKGROUND_IMG=background.png

+ SYMLINKS_SCRIPT=MakeSymlinks

+ VOL_NAME=touchtracer

+ DMG_TEMP=touchtracer-temp.dmg

+ DMG=touchtracer.dmg

+ STAGING_DIR=_install

+ rm -rf _install touchtracer.dmg touchtracer-temp.dmg

+ echo '-- Copy application into install dir'

-- Copy application into install dir

+ mkdir _install

+ cp -a touchtracer.app/ _install

+ ln -s /Applications _install/Applications

+ mkdir _install/.background

+ cp data/background.png _install/.background/

+ cp data/MakeSymlinks _install/MakeSymlinks

+ echo '-- Create volume'

-- Create volume

+ du -sm _install

+ awk '{print $1}'

++ cat _size

+ expr 277 + 6

++ cat _size

+ hdiutil create -srcfolder _install -volname touchtracer -fs HFS+ -format UDRW -size 283M touchtracer-temp.dmg

...............................................................................

.....................................................................................................................................................could not access /Volumes/touchtracer/Contents/Resources/venv/lib/python2.7/site-packages/wand/drawing.py - Plus d’espace libre sur le périphérique


hdiutil: create failed - Plus d’espace libre sur le périphérique



I'll now try the other packaging method. 
It seems I'm cursed: I tried packaging on the Windows64 platform, and I also get error with Tree from pyinstaller behind not properly copied......

qua non

unread,
Nov 21, 2015, 9:38:01 AM11/21/15
to kivy-...@googlegroups.com
OPQ whats the output of path/to/yourapp.app/contents/Resources/script when run from terminal?

We need to know what's failing.

--

OPQ

unread,
Nov 21, 2015, 12:39:06 PM11/21/15
to Kivy users support
When I execute the path below from command line , touchracer is starting with a standard output.

I really think this a something to do wth mac security feature of trsuted developper.

qua non

unread,
Nov 27, 2015, 10:29:24 AM11/27/15
to kivy-...@googlegroups.com
Ok, so there are too many issues with El capitan and development of apps that use script as a launcher. These issues are due to the SIP enforcing re setting of some env variables,


If I download kivy from git and try to compile then use it even for development, I can't. You have to either 1) disable SIP(not a good option)
2) use a virtualenv
3) Use the symlink from Kivy.app tp launch the app

The app packaged using Kivy.app though is working for me as is.
@OPQ could you test the attached application, does it work for you?

OPQ

unread,
Nov 27, 2015, 2:17:20 PM11/27/15
to Kivy users support
I tested the attached application.
It worked...BUT, I have SIP disabled.

So, I re-enabled SIP, restart the application & it worked again (but that may not be conclusive)

Hope this helps. 
As a sidenote, how did you package the dmg ? When I try, I get an error with 'not enoug disk space on device' ? 

qua non

unread,
Nov 27, 2015, 3:41:35 PM11/27/15
to kivy-...@googlegroups.com
I used the new packaging method,  but just to be sure I re-did the kivy.app using ./create-sdk-bundle.sh instead of using the one from kivy download page.

Though for me even that was working as is.

I will try to explain what happens here.

There Kivy.app is a self contained app that launches a script located in Kivy.app/Conetents/Resources/script
This script essentially sets up the paths and activates the relocatable virtualenv contained with in that package.

Essentially this script after activating the virtualenv within that package looks for a folder named `yourapp` in the folder the script is contained.
If the folder is there then the script tries to launch main.py/pyo from that folder.

So essentially to package your app you can simply include your app in that folder.
If the script is not able to find a main.py or if that folder does not exist then the python from virtualenv is launched just normally passing along args from the script to python. Thus allowing Kivy.app to be used as a development setup or a deployment one.

The error you mention does not male much sense to me,  I would need to see more log/output.

Does simply replacing `yourapp` folder with your app in the .app I posted work?

Maybe we needed just to have a new Kivy.app created for el-capitan?


OPQ

unread,
Nov 28, 2015, 3:13:39 AM11/28/15
to Kivy users support
OK, so here is what I tried:

1) opening your dmg file and directly double click on the showcase.app in the dmg finder's window: it launched
2) pasting your showcase.app in a folder and double click on this new showcase.app : it worked
3) in the new showcase.app, I pasted all my code in the yourapp folder and double clicked on the showcase.app: KO. nothing launch
4) in command line, directly launch the script showcase.app/resouces/content/script: script start but error on a simple import: from kivy.logger import Logger: import error: No module named 'kivy.logger'
5) Even if this is handled, you can I add some libraries (like reportlab or numpy) to your showcase.app

Thanks for trying ! 

P.S: regarding additional log for the output of my app, there are none: when the script is launched through command line, it works. But when double clicked, it does not launch.

qua non

unread,
Nov 29, 2015, 7:20:59 PM11/29/15
to kivy-...@googlegroups.com
To make the Showcase.app smaller I had removed a lot of files like logger etc.

I am attaching the Kivy.app made on el-capitan that contains everything.

To include/install files in this portable, you have to activate the venv
and then simply install the packages/files you need using pip or other methods.


OPQ

unread,
Dec 1, 2015, 4:52:53 AM12/1/15
to Kivy users support
It Worked !!! Thanks so much

I also was able to activate venv & add the packag I needed. I was just prompted by the Security feature of OSX & allowed the execution of the exe. 
I'll publish my application & revert for any comment.

You really should either post that to the Official Download Site or explain in the documentation how you created this app for El Capitan ! 

Thanks again

qua non

unread,
Dec 1, 2015, 6:04:18 AM12/1/15
to kivy-...@googlegroups.com
We are at the verge of releasing 1.9.1 and adding new docs for this new release. Will be updating the docs with this fix for new packaging method  & also for pyinstaller etc with the latest pyinstaller shortly.
Reply all
Reply to author
Forward
0 new messages