kivy / kivy-ios

Toolchain for compiling Python / Kivy / other libraries for iOS
https://kivy.org/docs/guide/packaging-ios.html
MIT License
759 stars 238 forks source link

toolchain build python3 kivy fails downloading freetype #724

Closed rjriv closed 2 years ago

rjriv commented 2 years ago

Using macOS 12.4, XCode 13.4.1, and Python 3.10.5 I have tried to install kivy-ios following the instructions here on github.

I created a virtual environment, installed kivy, and ensured that I could create and run a simple application:

from kivy.app import App

class MyApp(App):
    pass

MyApp().run()

Then I installed kivy-ios, and the prerequisite "brew" items. So far so good.

Then when I execute:

toolchain build python3 kivy

the execution fails when trying to download "freetype," which prevents the build from proceeding any further:

[INFO    ] Downloading https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.5.5.tar.bz2
[WARNING ] Download failed. Retrying in 1 second...
[WARNING ] Download failed. Retrying in 1 second...
[WARNING ] Download failed. Retrying in 1 second...
[WARNING ] Download failed. Retrying in 1 second...
[ERROR   ] Max download attempts reached: 5

This file can be downloaded manually, so I am not sure if this is a configuration error or if there is some incompatibility with my system.

misl6 commented 2 years ago

I can't reproduce it (on CI and locally), are you still encountering the issue? (Usually is a temporary failure)

dlewandaDK commented 2 years ago

I'm not seeing that issue, but instead the download "finishes" immediately but the file is not found when trying to extract:

% toolchain build kivy
[INFO    ] Building with 10 processes, where supported
[INFO    ] Want to build ['kivy']
[INFO    ] Loaded recipe kivy (depends of ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'ios', 'pyobjus', 'python', 'host_setuptools3'], optional are [])
[INFO    ] Loaded recipe sdl2 (depends of [], optional are [])
[INFO    ] Loaded recipe sdl2_image (depends of ['sdl2'], optional are [])
[INFO    ] Loaded recipe sdl2_mixer (depends of ['sdl2'], optional are [])
[INFO    ] Loaded recipe sdl2_ttf (depends of ['sdl2', 'freetype'], optional are [])
[INFO    ] Loaded recipe ios (depends of ['python'], optional are [])
[INFO    ] Loaded recipe pyobjus (depends of ['python'], optional are [])
[INFO    ] Loaded recipe python (depends of ['python3'], optional are [])
[INFO    ] Loaded recipe host_setuptools3 (depends of ['openssl', 'hostpython3', 'python3'], optional are [])
[INFO    ] Loaded recipe freetype (depends of [], optional are [])
[INFO    ] Loaded recipe python3 (depends of ['hostpython3', 'libffi', 'openssl'], optional are [])
[INFO    ] Loaded recipe openssl (depends of [], optional are [])
[INFO    ] Loaded recipe hostpython3 (depends of ['hostlibffi', 'hostopenssl'], optional are [])
[INFO    ] Loaded recipe libffi (depends of [], optional are [])
[INFO    ] Loaded recipe hostlibffi (depends of [], optional are [])
[INFO    ] Loaded recipe hostopenssl (depends of [], optional are [])
[INFO    ] Build order is ['freetype', 'hostlibffi', 'hostopenssl', 'libffi', 'openssl', 'sdl2', 'hostpython3', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python3', 'host_setuptools3', 'python', 'ios', 'pyobjus', 'kivy']
[INFO    ] Recipe order is ['freetype', 'hostlibffi', 'hostopenssl', 'libffi', 'openssl', 'sdl2', 'hostpython3', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'python3', 'host_setuptools3', 'ios', 'pyobjus', 'kivy']
[INFO    ] Include dir added: {arch.arch}/freetype
[INFO    ] Include dir added: {arch.arch}/hostlibffi
[INFO    ] Include dir added: {arch.arch}/ffi
[INFO    ] Include dir added: {arch.arch}/openssl
[INFO    ] Include dir added: common/sdl2
[INFO    ] Global: hostpython located at /Users/dlewanda/Development/Python-iOS/dist/hostpython3/bin/python
[INFO    ] Global: hostpgen located at /Users/dlewanda/Development/Python-iOS/dist/hostpython3/bin/pgen
[INFO    ] Include dir added: common/sdl2_image
[INFO    ] Include dir added: common/sdl2_mixer
[INFO    ] Include dir added: common/sdl2_ttf
[DEBUG   ] Cached result: Download freetype. Ignoring
[INFO    ] Extract freetype
[INFO    ] Extract freetype for x86_64
Traceback (most recent call last):
  File "/opt/homebrew/bin/toolchain", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1519, in main
    ToolchainCL()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1276, in __init__
    getattr(self, args.command)()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1337, in build
    build_recipes(args.recipe, ctx)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1127, in build_recipes
    recipe.execute()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 698, in execute
    self.extract()
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 73, in _cache_execution
    f(self, *args, **kwargs)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 742, in extract
    self.extract_arch(arch.arch)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 746, in extract_arch
    dest_dir = join(build_dir, self.archive_root)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 689, in archive_root
    value = self.get_archive_rootdir(self.archive_fn)
  File "/opt/homebrew/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 518, in get_archive_rootdir
    archive = tarfile.open(filename)
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tarfile.py", line 1620, in open
    return func(name, "r", fileobj, **kwargs)
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tarfile.py", line 1684, in gzopen
    fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
  File "/opt/homebrew/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/gzip.py", line 173, in __init__
    fileobj = self.myfileobj = builtins.open(filename, mode or 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/Users/dlewanda/Development/Python-iOS/.cache/freetype-freetype-2.5.5.tar.bz2'

Thankfully I was able to manually download the file from the URL @rjriv specified above (not in my output) and place it in the .cache directory with the different name (freetype-freetype-2.5.5.tar.bz2 instead of freetype-2.5.5.tar.bz2) and I was able to get past that error, but it seems like there's something up with where freetype is being fetched from.

ashlynns commented 2 years ago

I am in the same dev environment and encountered this same problem. After a bit of digging, I found out it was due to a client-side SSL issue.

The command I ran to fix this issue: /Applications/Python\ 3.10/Install\ Certificates.command

The stack overflow post that actually helped me understand the problem: here

rjriv commented 2 years ago

Hi @ashlynns, yes, this is what I get for for not paying attention to the python install dialog on macOS... "Please run the Install Certificates.command to finish the installation."

Sigh.

This is not a kivy-ios issue and can be closed.

Thanks for the help!