kivy / kivy-ios

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

toolchain pip3 install pycryptodome error #755

Closed mrtruongleo closed 1 year ago

mrtruongleo commented 1 year ago

Versions

I'm working on a project that uses keccak, so I'm trying to install pycryptodome or pysha3 using toolchain, but no luck...:( I can install almost all other modules without error, but pycryptodome or pysah3 does. I followed the instructions here

I used both way to install kivy-ios and try install pycryptodome but nothing worked: I upgraded: toolchain pip3 install wheel setuptools pip --upgrade

  1. toolchain pip3 install pycryptodome
  2. clone kivy-ios,... and run: python3 toolchain.py pip3 install pycryptodome

If I install pycryptodome with command: pip(or pip3) install pycryptodome the module is installed without problems. OR i have a macbook using intell chip (OS Monterey), and can install pycryptodome via command toolchain pip3 install pycryptodome without problem. I think maybe this is a bug unique to the M1 chip. I tried to downgrade Ventura to Monterey then same error came in. i also tried to copy installed module Crypto (this is pycryptodome's package name) from macbook intel to macmini M1 to test my application with xcode but it gives incompatibility error. I hope someone can help me to install this module using toolchain pip, not pip only

Logs this is the error when running toolchain pip3 install pycryptodome

leo@mac-mini% toolchain pip3 install pycryptodome
[INFO    ] Using the bundled version for recipe 'freetype'
[INFO    ] Include dir added: {arch.arch}/freetype
[INFO    ] Using the bundled version for recipe 'host_setuptools3'
[INFO    ] Using the bundled version for recipe 'hostopenssl'
[INFO    ] Using the bundled version for recipe 'hostpython3'
[INFO    ] Global: hostpython located at /Users/leo/kivy/ios/cab/dist/hostpython3/bin/python
[INFO    ] Global: hostpgen located at /Users/leo/kivy/ios/cab/dist/hostpython3/bin/pgen
[INFO    ] Using the bundled version for recipe 'ios'
[INFO    ] Using the bundled version for recipe 'kivy'
[INFO    ] Using the bundled version for recipe 'libffi'
[INFO    ] Include dir added: {arch.arch}/ffi
[INFO    ] Using the bundled version for recipe 'libjpeg'
[INFO    ] Include dir added: {arch.arch}/libjpeg
[INFO    ] Using the bundled version for recipe 'numpy'
[INFO    ] Include dir added: common/numpy
[INFO    ] Using the bundled version for recipe 'openssl'
[INFO    ] Include dir added: {arch.arch}/openssl
[INFO    ] Using the bundled version for recipe 'pillow'
[INFO    ] Using the bundled version for recipe 'pycrypto'
[INFO    ] Using the bundled version for recipe 'pyobjus'
[INFO    ] Using the bundled version for recipe 'python3'
[INFO    ] Using the bundled version for recipe 'sdl2'
[INFO    ] Include dir added: common/sdl2
[INFO    ] Using the bundled version for recipe 'sdl2_image'
[INFO    ] Include dir added: common/sdl2_image
[INFO    ] Using the bundled version for recipe 'sdl2_mixer'
[INFO    ] Include dir added: common/sdl2_mixer
[INFO    ] Using the bundled version for recipe 'sdl2_ttf'
[INFO    ] Include dir added: common/sdl2_ttf
[INFO    ] Executing pip with: ['install', '--isolated', '--prefix', '/Users/leo/kivy/ios/cab/dist/root/python3', 'pycryptodome']
[INFO    ] Running Shell: /Users/leo/kivy/ios/cab/dist/hostpython3/bin/pip3 ('install', '--isolated', '--prefix', '/Users/leo/kivy/ios/cab/dist/root/python3', 'pycryptodome') {'_env': {'CC': '/bin/false', 'CXX': '/bin/false', 'PYTHONPATH': '/Users/leo/kivy/ios/cab/dist/root/python3/lib/python3.9/site-packages', 'PYTHONOPTIMIZE': '2'}, '_iter': True, '_out_bufsize': 1, '_err_to_out': True}
[DEBUG   ] Collecting pycryptodome
[DEBUG   ]   Using cached pycryptodome-3.16.0.tar.gz (4.5 MB)
[DEBUG   ]   Preparing metadata (setup.py) ... done
[DEBUG   ] Building wheels for collected packages: pycryptodome
[DEBUG   ]   Building wheel for pycryptodome (setup.py) ... error
[DEBUG   ]   error: subprocess-exited-with-error
[DEBUG   ]   
[DEBUG   ]   ? python setup.py bdist_wheel did not run successfully.
[DEBUG   ]   ? exit code: 1
[DEBUG   ]   ??> [333 lines of output]
[DEBUG   ]       Testing support for clang
[DEBUG   ]       Target does not support clang
[DEBUG   ]       Testing support for gcc
[DEBUG   ]       Target does not support gcc
[DEBUG   ]       Testing support for stdint.h header
[DEBUG   ]       Target does not support stdint.h header
[DEBUG   ]       Testing support for 128-bit integer
[DEBUG   ]       Target does not support 128-bit integer
[DEBUG   ]       Testing support for cpuid.h header
[DEBUG   ]       Target does not support cpuid.h header
[DEBUG   ]       Testing support for intrin.h header
[DEBUG   ]       Target does not support intrin.h header
[DEBUG   ]       Testing support for posix_memalign
[DEBUG   ]       Target does not support posix_memalign
[DEBUG   ]       Testing support for memalign
[DEBUG   ]       Target does not support memalign
[DEBUG   ]       Testing support for SSE2(intrin.h)
[DEBUG   ]       Target does not support SSE2(intrin.h)
[DEBUG   ]       Testing support for SSE2(x86intrin.h)
[DEBUG   ]       Target does not support SSE2(x86intrin.h)
[DEBUG   ]       Testing support for SSE2(emmintrin.h)
[DEBUG   ]       Target does not support SSE2(emmintrin.h)
[DEBUG   ]       Warning: compiler does not support AESNI instructions
[DEBUG   ]       Warning: compiler does not support CLMUL instructions
[DEBUG   ]       running bdist_wheel
[DEBUG   ]       running build
[DEBUG   ]       running build_py
[DEBUG   ]       creating build/lib.macosx-13.0-arm64-3.9
[DEBUG   ]       creating build/lib.macosx-13.0-arm64-3.9/Crypto
[DEBUG   ]       copying lib/Crypto/__init__.py -> build/lib.macosx-13.0-arm64-3.9/Crypto
[DEBUG   ]       creating build/lib.macosx-13.0-arm64-3.9/Crypto/Cipher
[DEBUG   ]       copying lib/Crypto/Cipher/CAST.py -> build/lib.macosx-13.0-arm64-3.9/Crypto/Cipher
...
...
...
[DEBUG   ]       copying lib/Crypto/Math/Numbers.pyi -> build/lib.macosx-13.0-arm64-3.9/Crypto/Math
[DEBUG   ]       copying lib/Crypto/Math/_IntegerNative.pyi -> build/lib.macosx-13.0-arm64-3.9/Crypto/Math
[DEBUG   ]       running build_ext
[DEBUG   ]       building 'Crypto.Hash._MD2' extension
[DEBUG   ]       creating build/temp.macosx-13.0-arm64-3.9
[DEBUG   ]       creating build/temp.macosx-13.0-arm64-3.9/src
[DEBUG   ]       /bin/false -DPYCRYPTO_LITTLE_ENDIAN -DSYS_BITS=64 -DLTC_NO_ASM -Isrc/ -I/Users/leo/kivy/ios/cab/dist/hostpython3/include/python3.9 -c src/MD2.c -o build/temp.macosx-13.0-arm64-3.9/src/MD2.o
[DEBUG   ]       error: command '/bin/false' failed: No such file or directory
[DEBUG   ]       [end of output]
[DEBUG   ]   
[DEBUG   ]   note: This error originates from a subprocess, and is likely not a problem with pip.
[DEBUG   ]   ERROR: Failed building wheel for pycryptodome
[DEBUG   ]   Running setup.py clean for pycryptodome
[DEBUG   ] Failed to build pycryptodome
[DEBUG   ] Installing collected packages: pycryptodome
[DEBUG   ]   Running setup.py install for pycryptodome ... error
[DEBUG   ]   error: subprocess-exited-with-error
[DEBUG   ]   
[DEBUG   ]   ? Running setup.py install for pycryptodome did not run successfully.
[DEBUG   ]   ? exit code: 1
[DEBUG   ]   ??> [333 lines of output]
[DEBUG   ]       Testing support for clang
[DEBUG   ]       Target does not support clang
[DEBUG   ]       Testing support for gcc
[DEBUG   ]       Target does not support gcc
[DEBUG   ]       Testing support for stdint.h header
[DEBUG   ]       Target does not support stdint.h header
[DEBUG   ]       Testing support for 128-bit integer
[DEBUG   ]       Target does not support 128-bit integer
[DEBUG   ]       Testing support for cpuid.h header
[DEBUG   ]       Target does not support cpuid.h header
[DEBUG   ]       Testing support for intrin.h header
[DEBUG   ]       Target does not support intrin.h header
[DEBUG   ]       Testing support for posix_memalign
[DEBUG   ]       Target does not support posix_memalign
[DEBUG   ]       Testing support for memalign
[DEBUG   ]       Target does not support memalign
[DEBUG   ]       Testing support for SSE2(intrin.h)
[DEBUG   ]       Target does not support SSE2(intrin.h)
[DEBUG   ]       Testing support for SSE2(x86intrin.h)
[DEBUG   ]       Target does not support SSE2(x86intrin.h)
[DEBUG   ]       Testing support for SSE2(emmintrin.h)
[DEBUG   ]       Target does not support SSE2(emmintrin.h)
[DEBUG   ]       Warning: compiler does not support AESNI instructions
[DEBUG   ]       Warning: compiler does not support CLMUL instructions
[DEBUG   ]       running install
[DEBUG   ]       running build
[DEBUG   ]       running build_py
[DEBUG   ]       creating build/lib.macosx-13.0-arm64-3.9
[DEBUG   ]       creating build/lib.macosx-13.0-arm64-3.9/Crypto
[DEBUG   ]       copying lib/Crypto/__init__.py -> build/lib.macosx-13.0-arm64-3.9/Crypto
[DEBUG   ]       creating build/lib.macosx-13.0-arm64-3.9/Crypto/Cipher
..
..
...
[DEBUG   ]       copying lib/Crypto/Math/Numbers.pyi -> build/lib.macosx-13.0-arm64-3.9/Crypto/Math
[DEBUG   ]       copying lib/Crypto/Math/_IntegerNative.pyi -> build/lib.macosx-13.0-arm64-3.9/Crypto/Math
[DEBUG   ]       running build_ext
[DEBUG   ]       building 'Crypto.Hash._MD2' extension
[DEBUG   ]       creating build/temp.macosx-13.0-arm64-3.9
[DEBUG   ]       creating build/temp.macosx-13.0-arm64-3.9/src
[DEBUG   ]       /bin/false -DPYCRYPTO_LITTLE_ENDIAN -DSYS_BITS=64 -DLTC_NO_ASM -Isrc/ -I/Users/leo/kivy/ios/cab/dist/hostpython3/include/python3.9 -c src/MD2.c -o build/temp.macosx-13.0-arm64-3.9/src/MD2.o
[DEBUG   ]       error: command '/bin/false' failed: No such file or directory
[DEBUG   ]       [end of output]
[DEBUG   ]   
[DEBUG   ]   note: This error originates from a subprocess, and is likely not a problem with pip.
[DEBUG   ] error: legacy-install-failure
[DEBUG   ] 
[DEBUG   ] ? Encountered error while trying to install package.
[DEBUG   ] ??> pycryptodome
[DEBUG   ] 
[DEBUG   ] note: This is an issue with the package mentioned above, not pip.
[DEBUG   ] hint: See above for output from the failure.
[DEBUG   ] 
Exception in thread background thread for pid 10043:
Traceback (most recent call last):
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 1641, in wrap
    fn(*rgs, **kwargs)
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 2569, in background_thread
    handle_exit_code(exit_code)
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 2269, in fn
    return self.command.handle_command_exit_code(exit_code)
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /Users/leo/kivy/ios/cab/dist/hostpython3/bin/pip3 install --isolated --prefix /Users/leo/kivy/ios/cab/dist/root/python3 pycryptodome

  STDOUT:
Collecting pycryptodome
  Using cached pycryptodome-3.16.0.tar.gz (4.5 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycryptodome
  Building wheel for pycryptodome (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [333 lines of output]
      Testing support for clang
      Target does not support clang
      Testing support for gcc
      Target does not support gcc
      Testing support for stdint.h header
      Target does not support stdint.h header
... (67152 more, please see e.stdout)

  STDERR:

Traceback (most recent call last):
  File "/Users/leo/.pyenv/versions/3.9.9/bin/toolchain", line 8, in <module>
    sys.exit(main())
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1555, in main
    ToolchainCL()
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1299, in __init__
    getattr(self, args.command)()
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1511, in pip3
    self.pip()
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1514, in pip
    _pip(sys.argv[2:])
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 1186, in _pip
    shprint(pip_cmd, *args, _env=pip_env)
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/kivy_ios/toolchain.py", line 56, in shprint
    for line in cmd:
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 915, in next
    self.wait()
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 845, in wait
    self.handle_command_exit_code(exit_code)
  File "/Users/leo/.pyenv/versions/3.9.9/lib/python3.9/site-packages/sh.py", line 869, in handle_command_exit_code
    raise exc
sh.ErrorReturnCode_1: 

  RAN: /Users/leo/kivy/ios/cab/dist/hostpython3/bin/pip3 install --isolated --prefix /Users/leo/kivy/ios/cab/dist/root/python3 pycryptodome

  STDOUT:
Collecting pycryptodome
  Using cached pycryptodome-3.16.0.tar.gz (4.5 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycryptodome
  Building wheel for pycryptodome (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [333 lines of output]
      Testing support for clang
      Target does not support clang
      Testing support for gcc
      Target does not support gcc
      Testing support for stdint.h header
      Target does not support stdint.h header
... (67152 more, please see e.stdout)

  STDERR:
misl6 commented 1 year ago

Hi @mrtruongleo !

We're tracking the feature request here: https://github.com/kivy/kivy-ios/issues/701 (I've just renamed the issue, as it wasn't showing up while searching into issues)

mrtruongleo commented 1 year ago

Thank you @misl6 So i need to wait for an update of kivy-ios or from pycryptodome to be able to install? Note that I can install normally on macbookair with intel chip, but not with m1 chip.