0

I'm trying to create an OSx app using py2app.

I used the py2app script without a problem:

py2applet --make-setup UltraProcCMD.py
python setup.py py2app

This app works fine when I don't use the nibabel package but when I do I get the following error:

File "nibabel/__init__.pyc", line 38, in <module>
File "nibabel/analyze.pyc", line 91, in <module>
File "nibabel/wrapstruct.pyc", line 111, in <module>
ImportError: cannot import name imageglobals

I've tried to explicitly import imageglobals. i.e. in the code:

from nibabel import imageglobals

This also produces an error in py2app but works fine in a script running in the python interpreter.

Anyone know what I'm missing? Any help will be greatly appreciated.

Edit: I have a feeling that py2app is not pulling all the dependencies from nibabel that it should. Is there a way to force the entire nibabel package to be included in the py2app?

Ben
  • 11
  • 3

1 Answers1

1

Found a simple solution!

py2app does not seem to import all the required dependencies within the nibabel package, and the nibabel package well known enough to have a custom py2app recipe.

So using:

python setup.py py2app --packages nibabel

instead of:

python setup.py py2app --packages nibabel

seems to force py2app to include the whole nibabel package

Ben
  • 11
  • 3