beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.12k stars 161 forks source link

Simply build iOS wheel and get failed #179

Closed mhy15287570 closed 1 year ago

mhy15287570 commented 1 year ago

Describe the bug

I'm trying to build iOS wheels such as numpy, scipy, librosa, etc.

I had try to use briefcase and find it too heavy for my project, so I download tools from https://github.com/freakboy3742/chaquopy/tree/iOS-support/server/pypi, and it get failed when I build a wheel.

Could you please help me to check this? Thank you!

this is the log: python3 build-wheel.py --toolchain /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/toolchain --python 3.9 --os iOS numpy 666666666666666666666666 build-wheel.py: python3 -m pip --disable-pip-version-check install Cython==0.29.32 Requirement already satisfied: Cython==0.29.32 in /Library/Python/3.9/site-packages (0.29.32) build-wheel.py: mkdir -p /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2 build-wheel.py: cd /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2 build-wheel.py: mkdir -p /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2/cp39-cp39-ios_12_0_iphoneos_arm64 build-wheel.py: python3 -m pip --disable-pip-version-check download --no-deps --no-binary numpy --no-build-isolation numpy==1.24.2 Collecting numpy==1.24.2 Using cached https://files.pythonhosted.org/packages/e4/a9/6704bb5e1d1d778d3a6ee1278a8d8134f0db160e09d52863a24edb58eab5/numpy-1.24.2.tar.gz Saved ./numpy-1.24.2.tar.gz Preparing wheel metadata ... done Successfully downloaded numpy build-wheel.py: tar -C /var/folders/xb/kpnpttz1263dcb2_h93vwvr40000gn/T/build-wheel-jq_agejf -xf numpy-1.24.2.tar.gz build-wheel.py: mv /var/folders/xb/kpnpttz1263dcb2_h93vwvr40000gn/T/build-wheel-jq_agejf/numpy-1.24.2 /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2/cp39-cp39-ios_12_0_iphoneos_arm64/src build-wheel.py: rm -rf /var/folders/xb/kpnpttz1263dcb2_h93vwvr40000gn/T/build-wheel-jq_agejf build-wheel.py: mv /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2/cp39-cp39-ios_12_0_iphoneos_arm64/src/pyproject.toml /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2/cp39-cp39-ios_12_0_iphoneos_arm64/src/pyproject-chaquopy-disabled.toml build-wheel.py: cd /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2/cp39-cp39-ios_12_0_iphoneos_arm64/src build-wheel.py: patch -p1 -i /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/patches/get_include.patch patching file numpy/init.py Hunk #1 succeeded at 120 (offset 1 line). build-wheel.py: mkdir -p /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/packages/numpy/build/1.24.2/cp39-cp39-ios_12_0_iphoneos_arm64/requirements build-wheel.py: python3 -m pip --disable-pip-version-check wheel -v --no-deps --no-clean --build-option --keep-temp -e . Traceback (most recent call last): File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/mhy/Library/Python/3.9/lib/python/site-packages/pip/main.py", line 16, in from pip._internal import main as _main # isort:skip # noqa File "/Users/mhy/Library/Python/3.9/lib/python/site-packages/pip/_internal/init.py", line 40, in from pip._internal.cli.autocompletion import autocomplete File "/Users/mhy/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/autocompletion.py", line 8, in from pip._internal.cli.main_parser import create_main_parser File "/Users/mhy/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/main_parser.py", line 7, in from pip._internal.cli import cmdoptions File "/Users/mhy/Library/Python/3.9/lib/python/site-packages/pip/_internal/cli/cmdoptions.py", line 21, in from pip._internal.locations import USER_CACHE_DIR, get_src_prefix File "/Users/mhy/Library/Python/3.9/lib/python/site-packages/pip/_internal/locations.py", line 46, in site_packages = sysconfig.get_path("purelib") # type: Optional[str] File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/sysconfig.py", line 562, in get_path return get_paths(scheme, vars, expand)[name] File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/sysconfig.py", line 552, in get_paths return _expand_vars(scheme, vars) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/sysconfig.py", line 190, in _expand_vars res[key] = os.path.normpath(_subst_vars(value, vars)) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/sysconfig.py", line 171, in _subst_vars raise AttributeError('{%s}' % var) from None AttributeError: {'installed_base'} build-wheel.py: Error: Command returned exit status 1

Steps to reproduce

  1. run pip install -r requirements.txt
  2. download CMake.app, python-apple-support-v3.9, prepared toolchain
  3. learn from python3 build-wheel.py --help
  4. run python3 build-wheel.py --toolchain /Users/mhy/Downloads/chaquopy-iOS-support/server/pypi/toolchain --python 3.9 --os iOS numpy (or replace numpy by path in package/)
  5. get failed

Expected behavior

get numpy.iphoneos.so and numpy-iphonesimulator.so

Screenshots

No response

Environment

Logs

Additional context

No response

freakboy3742 commented 1 year ago

Transferring to the freakboy3742/chaquopy repo, since that's what this ticket relates to.

freakboy3742 commented 1 year ago

Can't transfer the issue because it's not in the same organisation.

My initial read of this stack trace is that your build environment hasn't been set up correctly - see this guide for setup instructions.

I'm also unclear why you're trying to build numpy from source. Beeware publishes pre-compiled wheels form numpy - there's no need to compile them on your own.

Closing this issue since it's not a problem with the Apple Support package. If you require additional assistance, please open an issue on the freakboy3742/chaquopy repo, which is the source of the problem you're having.