I followed these instructions to build Kivy and other recipes in my virtualbox macOS Big Sur virtual machine. When I ran toolchain build python3 kivy
or toolchain build kivy
, I encountered the below error. Any advice? Many thanks.
(venv) xxxx-iMac kivy-ios % toolchain build python3 kivy
[INFO ] Building with 2 processes, where supported
[INFO ] Want to build ['python3', 'kivy']
[INFO ] Loaded recipe python3 (depends of ['hostpython3', 'libffi', 'openssl'], optional are [])
[INFO ] Loaded recipe kivy (depends of ['sdl2', 'sdl2_image', 'sdl2_mixer', 'sdl2_ttf', 'ios', 'pyobjus', 'python', 'host_setuptools3'], optional are [])
[INFO ] Loaded recipe hostpython3 (depends of ['hostlibffi', 'hostopenssl'], optional are [])
[INFO ] Loaded recipe libffi (depends of [], optional are [])
[INFO ] Loaded recipe openssl (depends of [], 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 hostlibffi (depends of [], optional are [])
[INFO ] Loaded recipe hostopenssl (depends of [], optional are [])
[INFO ] Loaded recipe freetype (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/jesscarlett/kivy-ios/dist/hostpython3/bin/python
[INFO ] Global: hostpgen located at /Users/jesscarlett/kivy-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
[INFO ] Download freetype
[INFO ] Downloading http://download.savannah.gnu.org/releases/freetype/freetype-2.5.5.tar.bz2
Traceback (most recent call last):
File "/Users/jesscarlett/venv/bin/toolchain", line 8, in <module>
sys.exit(main())
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1519, in main
ToolchainCL()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1276, in __init__
getattr(self, args.command)()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1337, in build
build_recipes(args.recipe, ctx)
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1127, in build_recipes
recipe.execute()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 697, in execute
self.download()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 73, in _cache_execution
f(self, *args, **kwargs)
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 732, in download
self.download_file(self.url.format(version=self.version), fn)
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 473, in download_file
urlretrieve(url, filename, report_hook)
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1847, in retrieve
block = fp.read(bs)
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tempfile.py", line 474, in func_wrapper
return func(*args, **kwargs)
ValueError: read of closed file
This is when I ran:
(venv) xxxxx-iMac kivy-ios % toolchain build kivy
[INFO ] Building with 2 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/jesscarlett/kivy-ios/dist/hostpython3/bin/python
[INFO ] Global: hostpgen located at /Users/jesscarlett/kivy-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
[INFO ] Download freetype
[WARNING ] Error extracting the archive /Users/jesscarlett/kivy-ios/.cache/freetype-freetype-2.5.5.tar.bz2
[WARNING ] This is usually caused by a corrupt download. The file will be removed and re-downloaded on the next run.
[WARNING ] /Users/jesscarlett/kivy-ios/.cache/freetype-freetype-2.5.5.tar.bz2
[DEBUG ] New State: freetype.download at 2021-09-29 06:48:32.453443
[INFO ] Extract freetype
[INFO ] Extract freetype for x86_64
[WARNING ] Error extracting the archive /Users/jesscarlett/kivy-ios/.cache/freetype-freetype-2.5.5.tar.bz2
[WARNING ] This is usually caused by a corrupt download. The file will be removed and re-downloaded on the next run.
[WARNING ] /Users/jesscarlett/kivy-ios/.cache/freetype-freetype-2.5.5.tar.bz2
Traceback (most recent call last):
File "/Users/jesscarlett/venv/bin/toolchain", line 8, in <module>
sys.exit(main())
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1519, in main
ToolchainCL()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1276, in __init__
getattr(self, args.command)()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1337, in build
build_recipes(args.recipe, ctx)
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1127, in build_recipes
recipe.execute()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 698, in execute
self.extract()
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 73, in _cache_execution
f(self, *args, **kwargs)
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 742, in extract
self.extract_arch(arch.arch)
File "/Users/jesscarlett/venv/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 746, in extract_arch
dest_dir = join(build_dir, self.archive_root)
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py", line 90, in join
genericpath._check_arg_types('join', a, *p)
File "/usr/local/Cellar/[email protected]/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/genericpath.py", line 152, in _check_arg_types
raise TypeError(f'{funcname}() argument must be str, bytes, or '
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
3
Answers
Dear Taka (refer to Taka's post), thanks so much. This is the best answer I have ever seen for months. Your method saved the kivy on my MAC as well as my MAC VM. What happened was the version freetype-2.5.5 was moved to another sub folder on the savannah site. The newer version is 2.10.0. This is how I fixed my problem:
go to the init.py, update the version = "2.10.0". I can't just run
toolchain build python3 kivy
. This will throw error again.I then have to go to the site, download the freetype-2.10.0.tar.bz2 file and save it in the .cache/ folder. This is how to go to the .cache folder in your MAC. Go to Finder -> Go -> Go to Folder -> type in /users/{username}/.cache
Your _init_.py file in freetype folder (For example, /Library/Frameworks/Python.framework/Versions/3.x/lib/python3.x/site-packages/kivy_ios/recipes/freetype/_init_.py) is referring to obsolete URL link, so you just need to edit the file and modify the "url = " like,
One way to solve this is to download the expected freetype package from here:
https://download-mirror.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.5.5.tar.bz2
And then move it to the expected location. So in your case, you could run:
mv ~/Downloads/free-type-2.5.5.tar.bz2 ~/kivy-ios/.cache/freetype-freetype-2.5.5.tar.bz2
Then rerun build and it will get around the issue.
However, I think this error may indicate an environment issue. You should verify that you are using the correct version of Python3 for Kivy (which is currently 3.7.x). Check
python3 --version
.