Pyinstaller error: 'SystemError: codesign failure!' on macOS - python-3.x

I have made an application that I am now distributing on macos and windows (windows successfully compiled) but when I try to compile my app it keeps throwing the error SystemError: codesign failure! In pyinstaller I am using the --onefile flag, and I have tried it without the flag (python pyinstaller.py app.py, I could not use python pyinstaller app.py as I was thrown command not found). This is the full error message:
326 INFO: Building PKG (CArchive) PKG-00.pkg
4245 WARNING: codesign command (['codesign', '-s', '-', '--force', '--all-architectures', '--timestamp', '/Users/admin/Library/Application Support/pyinstaller/bincache00_py39_64bit/x86_64/adhoc/no-entitlements/lib-dynload/resource.cpython-39-darwin.so']) failed with error code 1!
stdout: ''
stderr: '/Users/admin/Library/Application Support/pyinstaller/bincache00_py39_64bit/x86_64/adhoc/no-entitlements/lib-dynload/resource.cpython-39-darwin.so: invalid or unsupported format for signature\n'
Traceback (most recent call last):
File "/Users/admin/Documents/Cloud/hero/pyinstaller.py", line 17, in <module>
run()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/__main__.py", line 126, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 815, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 762, in build
exec(code, spec_namespace)
File "/Users/admin/Documents/Cloud/hero/app.spec", line 23, in <module>
exe = EXE(pyz,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/api.py", line 509, in __init__
self.pkg = PKG(self.toc, cdict=kwargs.get('cdict', None),
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/api.py", line 208, in __init__
self.__postinit__()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/datastruct.py", line 159, in __postinit__
self.assemble()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/api.py", line 274, in assemble
fnm = checkCache(fnm, strip=self.strip_binaries,
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/building/utils.py", line 391, in checkCache
osxutils.sign_binary(cachedfile, codesign_identity, entitlements_file)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/PyInstaller/utils/osx.py", line 383, in sign_binary
raise SystemError("codesign failure!")
SystemError: codesign failure!
Since I have never compiled an app for mac and this is my first time doing it, I have no idea what this really means. This is using python 3.9.

This seems to be an issue with the way pyinstaller performs ad-hoc signing since codesigning changed sometime after 4.3 (see https://github.com/pyinstaller/pyinstaller/issues/6167). Building on the latest Big Sur (MacOS 11.5.2) should work fine but I assume you're on Catalina or earlier.
You can either:
Downgrade to pyinstaller 4.3 with pip uninstall pyinstaller and pip install -Iv pyinstaller==4.3 and then rebuild as you were.
or
Provide a certificate to sign the app yourself.
If you want to sign the app yourself you can do so like so:
Open Keychain Access
Go to the menu at the top of the screen and select Keychain Access > Certificate Assistant > Create a Certificate
In the window that appears change Certificate Type to Code Signing , select Create and note the name of the certificate
Build your pyinstaller source with the --codesign-identity <name> flag where <name> is the name of the certificate you created in step 3.

Related

OSError: Python library not found: libpython3.7.so.1.0, libpython3.7m.so.1.0

I am using pyinstaller on CentOS 7 to convert a .py file to an executable. I am on python3.7.6
I have done:
$python3.7 -m pip install pyinstaller
$pyinstaller test.py --onefile
This gives me:
8942 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
File "/usr/local/bin/pyinstaller", line 8, in <module>
sys.exit(run())
File "/usr/local/lib/python3.7/site-packages/PyInstaller/__main__.py", line 126, in run
run_build(pyi_config, spec_file, **vars(args))
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)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 815, in main
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 762, in build
exec(code, spec_namespace)
File "/root/test.spec", line 19, in <module>
noarchive=False)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 294, in __init__
self.__postinit__()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 159, in __postinit__
self.assemble()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 540, in assemble
self._check_python_library(self.binaries)
File "/usr/local/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 645, in _check_python_library
python_lib = bindepend.get_python_library_path()
File "/usr/local/lib/python3.7/site-packages/PyInstaller/depend/bindepend.py", line 967, in get_python_library_path
raise IOError(msg)
OSError: Python library not found: libpython3.7.so, libpython3.7.so.1.0, libpython3.7mu.so.1.0, libpython3.7m.so, libpython3.7m.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.
* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)
As pointed out here I have tried:
$env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.7.6
I have also installed python-devel:
$yum install python36-gobject-devel.x86_64
$yum install python3-devel.x86_64
$yum install python34-devel.x86_64
I am not sure what am I missing here. Any help will be appreciated.

How can I install Python 3.7 on an old centos shared web host (without root)?

I want to install Python 3.7 on a web hosting server that is live (production) without disturbing anything. I have SSH terminal access and I guess the server is running centos from the following commands:
> cat /proc/version
Linux version 3.10.0-693.11.6.1.ELK.el6.x86_64 (...) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) )
> rpm -qa centos-release
centos-release-6-10.el6.centos.12.3.x86_64
I tried to see what was installed with:
> rpm -qa | sort
...
Python27-2.7.8-1.x86_64
Python27-MySQL-1.2.3-2.el6.x86_64
Python27-bs4-4.1.3-1.noarch
Python27-distribute-0.6.32-1.noarch
Python27-lxml-3.0.1-1.x86_64
Python27-pip-1.2.1-1.noarch
Python27-regex-0.1.20120904-1.x86_64
Python27-virtualenv-1.8.4-1.noarch
Python3-3.2.3-1.x86_64
Python3-distribute-0.6.32-1.noarch
Python3-pip-1.2.1-1.noarch
Python3-virtualenv-1.8.4-1.noarch
...
So it looks like there's Python 2.7 and 3.2 already installed, and I don't want to disturb them.
I want to run a Python 3.7 script with dependencies on some modules.
What is the safest way of installing Python 3.7 (along with pip for modules) somewhere that will not mess with the current installation?
NOTE: I am familiar with conda/pip mostly on Windows, but I have limited knowledge of this linux environment.
EDIT: I first thought it was RHEL. I edited the post for centos.
EDIT: I have tried many unsuccessful attempts to install Python 3.7 on this shared web hosting:
Trying to create a virtualenv with Python 3.2:
> python3 -m virtualenv my_isolated_py3
New python executable in my_isolated_py3/bin/python3
Also creating executable in my_isolated_py3/bin/python
Installing distribute.....................
Complete output from command /home2/cccccc/my_isolated_py3/bin/python3 -c "#!python
\"\"\"Bootstra... sys.exit(main())
":
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.31.tar.gz
Traceback (most recent call last):
File "<string>", line 541, in <module>
File "<string>", line 537, in main
File "<string>", line 201, in download_setuptools
File "/opt/python3/lib/python3.2/urllib/request.py", line 138, in urlopen
return opener.open(url, data, timeout)
File "/opt/python3/lib/python3.2/urllib/request.py", line 375, in open
response = meth(req, response)
File "/opt/python3/lib/python3.2/urllib/request.py", line 487, in http_response
'http', request, response, code, msg, hdrs)
File "/opt/python3/lib/python3.2/urllib/request.py", line 413, in error
return self._call_chain(*args)
File "/opt/python3/lib/python3.2/urllib/request.py", line 347, in _call_chain
result = func(*args)
File "/opt/python3/lib/python3.2/urllib/request.py", line 495, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: SSL is required
----------------------------------------
...Installing distribute...done.
Traceback (most recent call last):
File "/opt/python3/lib/python3.2/runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/opt/python3/lib/python3.2/runpy.py", line 73, in _run_code
exec(code, run_globals)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 2560, in <module>
main()
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 964, in main
never_download=options.never_download)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 1071, in create_environment
search_dirs=search_dirs, never_download=never_download)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 616, in install_distribute
search_dirs=search_dirs, never_download=never_download)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 583, in _install_req
cwd=cwd)
File "/opt/python3/lib/python3.2/site-packages/virtualenv.py", line 1042, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home2/cccccc/my_isolated_py3/bin/python3 -c "#!python
\"\"\"Bootstra... sys.exit(main())
" failed with error code 1
The key error is urllib.error.HTTPError: HTTP Error 403: SSL is required, which seems related to old non-https repository.
Trying to create a virtualenv with Python 2.6:
> python -m virtualenv my_isolated_py2
Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 2352, in <module>
main()
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 825, in main
symlink=options.symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 985, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 1179, in install_python
copyfile(join(stdlib_dir, fn), join(lib_dir, fn), symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 479, in copyfile
copyfileordir(src, dest, symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 454, in copyfileordir
shutil.copytree(src, dest, symlink)
File "/usr/lib64/python2.6/shutil.py", line 173, in copytree
raise Error, errors
shutil.Error: [('/usr/lib64/python2.6/config/libpython2.6.so', 'my_isolated_py2/lib/python2.6/config/libpython2.6.so', '[Errno 2] No such file or directory')]
Trying to install Python 3.7 miniconda:
> wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.anaconda.com... 104.16.130.3, 104.16.131.3, 2606:4700::6810:8203, ...
Connecting to repo.anaconda.com|104.16.130.3|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 85055499 (81M) [application/x-sh]
Saving to: `Miniconda3-latest-Linux-x86_64.sh'
100%[=========================================>] 85,055,499 108M/s in 0.8s
2020-06-11 08:22:53 (108 MB/s) - `Miniconda3-latest-Linux-x86_64.sh' saved [85055499/85055499]
> bash Miniconda3-latest-Linux-x86_64.sh
...
Unpacking payload ...
Miniconda3-latest-Linux-x86_64.sh: line 409: /home2/cccccc/miniconda3/preconda.tar.bz2: No such file or directory
Trying to install Python 3.7 from sources:
> wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
> tar xvzf Python-3.7.3.tgz
> cd Python-3.7.3
> ./configure --prefix=$HOME/python_37
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.7... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in '/home2/cccccc/Python-3.7.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
Trying to install Python 3.7 portable binaries:
> wget https://github.com/indygreg/python-build-standalone/releases/download/20200408/cpython-3.7.7-linux64-20200409T0045.tar.zst
> [unzstd on another machine since not installed here]
> tar -xvf cpython-3.7.7-linux64-20200409T0045.tar
...
tar: python/install/share/man/man1/python3.1: Cannot create symlink to `python3.7.1': No such file or directory
...
> ./python/install/bin/python3.7m
./python/install/bin/python3.7m: /lib64/libc.so.6: version `GLIBC_2.13' not found (required by ./python/install/bin/python3.7m)
I also found out that this shared web hosting greatly limits what we can do through terminal, which is jailshell.
Do I have any options left to use Python 3.7 on this machine?
You can use venv to completely isolate your python environment from all other python versions (and python libraries) installed in the system.
Read the virtual environment, venv, docs here.

Slycot fails to import when using control

I cannot seem to get the control.ss2tf() function to work for state space MIMO system. The function works perfectly for a SISO system.
The following code is used to run the module:
control.ss2tf(A,B,C,D)
The resulting output indicated that the slycot module was not installed.
I then tried installing slycot with
pip install slycot
This command gave the following output:
Failed building wheel for slycot
Running setup.py clean for slycot
Failed to build slycot
Installing collected packages: slycot
Running setup.py install for slycot ... error
Complete output from command c:\users\wian\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Wian\\AppData\\Local\\Temp\\pip-install-cmcxwtts\\slycot\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Wian\AppData\Local\Temp\pip-record-_n6gj2yv\install-record.txt --single-version-externally-managed --compile:
Running from numpy source directory.
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
building extension "slycot._wrapper" sources
f2py options: []
adding 'build\src.win-amd64-3.6\build\src.win-amd64-3.6\slycot\src\fortranobject.c' to sources.
adding 'build\src.win-amd64-3.6\build\src.win-amd64-3.6\slycot\src' to include_dirs.
adding 'build\src.win-amd64-3.6\slycot\src\_wrapper-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
copying slycot\version.py -> build\lib.win-amd64-3.6\slycot
copying build\src.win-amd64-3.6\slycot\__config__.py -> build\lib.win-amd64-3.6\slycot
running build_ext
Looking for python36.dll
Building import library (arch=AMD64): "c:\users\wian\anaconda3\libs\libpython36.a" (from c:\users\wian\anaconda3\python36.dll)
objdump.exe: c:\users\wian\anaconda3\python36.dll: file format not recognized
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Wian\AppData\Local\Temp\pip-install-cmcxwtts\slycot\setup.py", line 241, in <module>
setup_package()
File "C:\Users\Wian\AppData\Local\Temp\pip-install-cmcxwtts\slycot\setup.py", line 233, in setup_package
setup(**metadata)
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\core.py", line 171, in setup
return old_setup(**new_attr)
File "c:\users\wian\anaconda3\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\wian\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\wian\anaconda3\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\users\wian\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\command\install.py", line 62, in run
r = self.setuptools_run()
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\command\install.py", line 36, in setuptools_run
return distutils_install.run(self)
File "c:\users\wian\anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\wian\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\wian\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\command\build.py", line 47, in run
old_build.run(self)
File "c:\users\wian\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\wian\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\wian\anaconda3\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\command\build_ext.py", line 116, in run
force=self.force)
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\ccompiler.py", line 765, in new_compiler
compiler = klass(None, dry_run, force)
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 103, in __init__
build_import_library()
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 415, in build_import_library
return _build_import_library_amd64()
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 471, in _build_import_library_amd64
generate_def(dll_file, def_file)
File "c:\users\wian\anaconda3\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 301, in generate_def
raise ValueError("Symbol table not found")
ValueError: Symbol table not found
I read that this is due to a FORTRAN compiler not installed on the system. I therefore installed gfortran with Ming32. To verify the install I ran the following:
(base) C:\WINDOWS\system32>gfortran
gfortran: fatal error: no input files
compilation terminated.
So gfortran is installed as a compiler, but yet pip remain unable to install slycot. I have also installed Microsoft Visual Studio 2017.
At this point I went to PyPi library to download the compiled binary of the slycot module. https://www.lfd.uci.edu/~gohlke/pythonlibs/
Here I downloaded the correct .whl file for my system (64 bit Python 3.6), and installed it with pip.
pip install "C:\Users\Wian\Desktop\slycot-0.3.3-cp36-cp36m-win_amd64.whl"
Using this command slycot 0.3.3 was installed successfully. However, when i run the command
control.ss2tf(A,B,C,D)
I get the following output
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\control\xferfcn.py in _convertToTransferFunction(sys, **kw)
1089 try:
-> 1090 from slycot import tb04ad
1091 if len(kw):
ImportError: cannot import name 'tb04ad'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
<ipython-input-8-2b014ac15956> in <module>()
----> 1 control.ss2tf(Model)
~\Anaconda3\lib\site-packages\control\xferfcn.py in ss2tf(*args)
1315 sys = args[0]
1316 if isinstance(sys, StateSpace):
-> 1317 return _convertToTransferFunction(sys)
1318 else:
1319 raise TypeError("ss2tf(sys): sys must be a StateSpace object. It \
~\Anaconda3\lib\site-packages\control\xferfcn.py in _convertToTransferFunction(sys, **kw)
1113 # If slycot is not available, use signal.lti (SISO only)
1114 if (sys.inputs != 1 or sys.outputs != 1):
-> 1115 raise TypeError("No support for MIMO without slycot")
1116
1117 # Do the conversion using sp.signal.ss2tf
TypeError: No support for MIMO without slycot
When I try to import slycot in Python, I get the following result:
>>> import slycot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Wian\Anaconda3\lib\site-packages\slycot\__init__.py", line 18, in <module>
from .analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, \
File "C:\Users\Wian\Anaconda3\lib\site-packages\slycot\analysis.py", line 21, in <module>
from . import _wrapper
ImportError: DLL load failed: The specified module could not be found.
There is a _wrapper.pyd file in the Slycot directory (under Anaconda3\Libs\site-packages).
This is where I am currently stuck, and I cannot get Slycot to import correctly.
Your help is greatly appreciated!

py2app Mach-O header error

I am trying to use py2app on the following code:
print(1+1)
I create my setup with:
py2applet --make-setup test.py
Development with alias mode works fine:
python3 setup.py py2app -A
But when I try the standalone mode:
python3 setup.py py2app
I get after a lot of lines:
WARNING: Mach-O header in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' may be too large to relocate
WARNING: Mach-O header in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' may be too large to relocate
Traceback (most recent call last):
File "setup.py", line 18, in <module>
setup_requires=['py2app'],
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/Cellar/python3/3.6.0/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 764, in run
self._run()
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 974, in _run
self.run_normal()
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 1082, in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/usr/local/lib/python3.6/site-packages/py2app/build_app.py", line 1385, in create_binaries
platfiles = mm.run()
File "/usr/local/lib/python3.6/site-packages/macholib/MachOStandalone.py", line 146, in run
node.write(f)
File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 133, in write
header.write(f)
File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 343, in write
self.synchronize_size()
File "/usr/local/lib/python3.6/site-packages/macholib/MachO.py", line 333, in synchronize_size
self.parent.filename, self.total_size + self.sizediff, self.low_offset, self.sizediff))
ValueError: New Mach-O header is too large to relocate in '/Users/quentinpeter/Documents/PHD/Python/People project/Michele_worms/dist/test.app/Contents/Resources/lib/python3.6/scipy/linalg/_interpolative.cpython-36m-darwin.so' (new size=1764, max size=1712, delta=108)
Do you have any idea what might happen? Most of the things I found online refers to MacPorts but I use homebrew.
info on my python:
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
I had the same problem and I fixed it by uninstalling the version of macholib that I had (1.8) and installing 1.7 with pip. When using python 2.7, reverting to scipy version 0.14.0 would fix it as well.

Python 3.4 buildozer android sdk download fail

I am using python 3.4 and i have installed kivy and buildozer succesfully but when i run the command "buildozer android debug". I am getting the following output. Please help to debug the issue.
# Install platform
# Apache ANT found at /home/paul/.buildozer/android/platform/apache-ant-1.8.4
# Android SDK is missing, downloading
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 9, in <module>
load_entry_point('buildozer==0.15', 'console_scripts', 'buildozer')()
File "/usr/local/lib/python3.4/dist-packages/buildozer/scripts/client.py", line 13, in main
Buildozer().run_command(sys.argv[1:])
File "/usr/local/lib/python3.4/dist-packages/buildozer/__init__.py", line 957, in run_command
self.target.run_commands(args)
File "/usr/local/lib/python3.4/dist-packages/buildozer/target.py", line 85, in run_commands
func(args)
File "/usr/local/lib/python3.4/dist-packages/buildozer/target.py", line 95, in cmd_debug
self.buildozer.prepare_for_build()
File "/usr/local/lib/python3.4/dist-packages/buildozer/__init__.py", line 157, in prepare_for_build
self.target.install_platform()
File "/usr/local/lib/python3.4/dist-packages/buildozer/targets/android.py", line 365, in install_platform
self._install_android_sdk()
File "/usr/local/lib/python3.4/dist-packages/buildozer/targets/android.py", line 235, in _install_android_sdk
raise SystemError('Unsupported platform: {0}'.format(platform))
SystemError: Unsupported platform: linux
Your version of bulldozer ist too old. There is this commit fixing the exact issue you have:
- elif platform in ('linux2', 'linux3'):
+ elif platform.startswith('linux'):
Upgrading to a more recent version will solve your problem.

Resources