Creating app package for OS X using pyinstaller fails

20 views
Skip to first unread message

Niehztog

unread,
Feb 5, 2020, 4:14:48 AM2/5/20
to PyInstaller
Hello,

I am currently trying to build an application package for os x of my kivy/kivymd application. Personally I use windows, so I set up an OSX High Sierra environment in VirtualBox.
When building the app package, I strictly followed this guide: https://kivy.org/doc/stable/guide/packaging-osx.html
(had to use "brew reinstall --force-bottle" instead of "brew reinstall --build-bottle" on the third step because build-bottle throws an error)

So I've build the .spec file for my application (see attachment) and modified it according to the guide above. Executing the command to build the package failes with an error message:
pyinstaller -y --clean --windowed myhelloworld.spec


36561 INFO: Building BUNDLE because BUNDLE-00.toc is non existent
36562 INFO: Removing dir /Users/niehztog/projects/myhelloworld/dist/myhelloworld.app
36607 INFO: Building BUNDLE BUNDLE-00.toc
42489 INFO: moving BUNDLE data files to Resource directory
On your own risk, you can use the option `--noconfirm` to get rid of this question.
On your own risk, you can use the option `--noconfirm` to get rid of this question.
 
Traceback (most recent call last):
43420 WARNING: stderr: Traceback (most recent call last):
   
File "/usr/local/bin/pyinstaller", line 8, in <module>
43421 WARNING: stderr:   File "/usr/local/bin/pyinstaller", line 8, in <module>
     sys
.exit(run())
43422 WARNING: stderr:     sys.exit(run())
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 114, in run
43423 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 114, in run
     run_build
(pyi_config, spec_file, **vars(args))
43426 WARNING: stderr:     run_build(pyi_config, spec_file, **vars(args))
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 65, in run_build
43426 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 65, in run_build
     
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
43427 WARNING: stderr:     PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 734, in main
43427 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 734, in main
     build
(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
43430 WARNING: stderr:     build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 681, in build
43431 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 681, in build
     
exec(code, spec_namespace)
43432 WARNING: stderr:     exec(code, spec_namespace)
   
File "myhelloworld.spec", line 41, in <module>
43432 WARNING: stderr:   File "myhelloworld.spec", line 41, in <module>
     bundle_identifier
=None)
43432 WARNING: stderr:     bundle_identifier=None)
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/osx.py", line 98, in __init__
43432 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/osx.py", line 98, in __init__
     
self.__postinit__()
43434 WARNING: stderr:     self.__postinit__()
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
43434 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
     
self.assemble()
43436 WARNING: stderr:     self.assemble()
   
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/osx.py", line 214, in assemble
43436 WARNING: stderr:   File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/osx.py", line 214, in assemble
     shutil
.copy(fnm, tofnm)
43438 WARNING: stderr:     shutil.copy(fnm, tofnm)
   
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 248, in copy
43438 WARNING: stderr:   File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 248, in copy
     copyfile
(src, dst, follow_symlinks=follow_symlinks)
43440 WARNING: stderr:     copyfile(src, dst, follow_symlinks=follow_symlinks)
   
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 120, in copyfile
43441 WARNING: stderr:   File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/shutil.py", line 120, in copyfile
     
with open(src, 'rb') as fsrc:
43442 WARNING: stderr:     with open(src, 'rb') as fsrc:
 
FileNotFoundError: [Errno 2] No such file or directory: '/Users/niehztog/projects/myhelloworld/dist/myhelloworld/dist/myhelloworld.app/Contents/Resources/lib/python3.7/config-3.7m-darwin/Makefile'
43443 WARNING: stderr: FileNotFoundError: [Errno 2] No such file or directory: '/Users/niehztog/projects/myhelloworld/dist/myhelloworld/dist/myhelloworld.app/Contents/Resources/lib/python3.7/config-3.7m-darwin/Makefile'


So the error says that its missing the python3 makefile expected to be located in /Users/niehztog/projects/myhelloworld/dist/myhelloworld/dist/myhelloworld.app/Contents/Resources/lib/python3.7/config-3.7m-darwin/Makefile
After investigating I found, that the whole directory "config-3.7m-darwin" is missing. I tried creating it and copied the makefile over using this command, but then the build command is missing other files aswell.
cp /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin/Makefile /Users/niehztog/projects/myhelloworld/dist/myhelloworld/dist/myhelloworld.app/Contents/Resources/lib/python3.7/config-3.7m-darwin/

the error I'm seeing after manually coping the missing file over is
FileNotFoundError: [Errno 2] No such file or directory: '/Users/niehztog/projects/myhelloworld/dist/myhelloworld.app/Contents/Resources/dist/myhelloworld.app/Contents/MacOS/.gitignore'

Something seems to be terribly wrong with the build routine. Obviously pyinstaller is missing files. I've alreaedy tried reinstalling python3 using brew, but this did not change anything. The files are present in the python3 install directory, but pyinstaller somehow does not correctly copy them to the target path where later steps are expecting them.

How can I fix this? Please help me.

Niehztog
myhelloworld.spec
Reply all
Reply to author
Forward
0 new messages