chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
837 stars 133 forks source link

TFLite Interpreter #453

Closed yahyanik closed 3 years ago

yahyanik commented 3 years ago

Chaquopy version: com.chaquo.python:gradle:9.0.0

Relevant parts of your build.gradle file

python{ pip{ install "opencv-python" install "pillow" install "numpy" install "scipy" install "scikit-learn" install "scikit-image" install "matplotlib" // install "tensorflow" install "tflite-support" install "imutils" // install "https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_aarch64.whl" } }

Describe your issue

I am trying to install TFLite interpreter on Python. The package "https://github.com/google-coral/pycoral/releases/download/release-frogfish/tflite_runtime-2.5.0-cp38-cp38-linux_aarch64.whl" fails with incompatible platfrom(the "tflite_runtime" source is provided in case there is a need to build wheel). And install "tflite-support" fails with log in the following.

LOGS:

Task :app:generateDebugPythonRequirements Task :app:generateDebugPythonRequirements in app Starting Caching disabled for task ':app:generateDebugPythonRequirements' because: Build cache is disabled Task ':app:generateDebugPythonRequirements' is not up-to-date because: Task has failed previously. Starting process 'command 'python3.8''. Working directory: /Users/seyednikouei/Programming/Image_Quality_Categorization/android/imageQualityCategorization/app Command: python3.8 -S -m chaquopy.pip_install --target /Users/seyednikouei/Programming/Image_Quality_Categorization/android/imageQualityCategorization/app/build/pip/debug --android-abis arm64-v8a --req opencv-python --req pillow --req numpy --req scipy --req scikit-learn --req scikit-image --req matplotlib --req tflite-support --req imutils -- --chaquopy 9.0.0 --isolated --no-build-isolation --disable-pip-version-check --cert /Users/seyednikouei/Programming/Image_Quality_Categorization/android/imageQualityCategorization/app/build/generated/python/pip/_vendor/certifi/cacert.pem --extra-index-url https://chaquo.com/pypi-7.0 --implementation cp --python-version 3.8.6 --abi cp38 --no-compile Successfully started process 'command 'python3.8'' Chaquopy: Installing for arm64-v8a Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0 Collecting opencv-python Using cached https://chaquo.com/pypi-7.0/opencv-python/opencv_python-4.5.1.48-1-cp38-cp38-android_21_arm64_v8a.whl Collecting pillow Using version 7.1.2 (newest version is 8.1.0, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/pillow/Pillow-7.1.2-0-cp38-cp38-android_21_arm64_v8a.whl Collecting numpy Using version 1.17.4 (newest version is 1.20.1, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/numpy/numpy-1.17.4-3-cp38-cp38-android_21_arm64_v8a.whl Collecting scipy Using version 1.4.1 (newest version is 1.6.0, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/scipy/scipy-1.4.1-0-cp38-cp38-android_21_arm64_v8a.whl Collecting scikit-learn Using version 0.23.2 (newest version is 0.24.1, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/scikit-learn/scikit_learn-0.23.2-2-cp38-cp38-android_21_arm64_v8a.whl Collecting scikit-image Using version 0.16.2 (newest version is 0.18.1, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/scikit-image/scikit_image-0.16.2-0-cp38-cp38-android_21_arm64_v8a.whl Collecting matplotlib Using version 3.1.2 (newest version is 3.3.4, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/matplotlib/matplotlib-3.1.2-1-cp38-cp38-android_21_arm64_v8a.whl Collecting tflite-support Using cached https://files.pythonhosted.org/packages/29/97/7af9b18583d9bb01cdfcd0ab446062ef97720ebf941e33f7b156861ed179/tflite-support-0.1.0a1.tar.gz Collecting imutils Collecting chaquopy-openblas>=0.2.20 (from opencv-python) Using cached https://chaquo.com/pypi-7.0/chaquopy-openblas/chaquopy_openblas-0.2.20-5-py3-none-android_21_arm64_v8a.whl Collecting chaquopy-libgfortran>=4.9 (from opencv-python) Using cached https://chaquo.com/pypi-7.0/chaquopy-libgfortran/chaquopy_libgfortran-4.9-0-py3-none-android_21_arm64_v8a.whl Collecting chaquopy-libjpeg>=1.5.3 (from opencv-python) Using cached https://chaquo.com/pypi-7.0/chaquopy-libjpeg/chaquopy_libjpeg-1.5.3-1-py3-none-android_21_arm64_v8a.whl Collecting chaquopy-libcxx>=7000 (from opencv-python) Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-7000-2-py3-none-android_21_arm64_v8a.whl Collecting chaquopy-libpng>=1.6.34 (from opencv-python) Using cached https://chaquo.com/pypi-7.0/chaquopy-libpng/chaquopy_libpng-1.6.34-1-py3-none-android_21_arm64_v8a.whl Collecting chaquopy-freetype>=2.9.1 (from pillow) Using cached https://chaquo.com/pypi-7.0/chaquopy-freetype/chaquopy_freetype-2.9.1-1-py3-none-android_21_arm64_v8a.whl Collecting joblib>=0.11 (from scikit-learn) Using cached https://files.pythonhosted.org/packages/55/85/70c6602b078bd9e6f3da4f467047e906525c355a4dacd4f71b97a35d9897/joblib-1.0.1-py3-none-any.whl Collecting threadpoolctl>=2.0.0 (from scikit-learn) Using cached https://files.pythonhosted.org/packages/f7/12/ec3f2e203afa394a149911729357aa48affc59c20e2c1c8297a60f33f133/threadpoolctl-2.1.0-py3-none-any.whl Collecting PyWavelets>=0.4.0 (from scikit-image) Using cached https://chaquo.com/pypi-7.0/pywavelets/PyWavelets-1.1.1-0-cp38-cp38-android_21_arm64_v8a.whl Collecting networkx>=2.0 (from scikit-image) Using cached https://files.pythonhosted.org/packages/9b/cd/dc52755d30ba41c60243235460961fc28022e5b6731f16c268667625baea/networkx-2.5-py3-none-any.whl Collecting imageio>=2.3.0 (from scikit-image) Using cached https://files.pythonhosted.org/packages/6e/57/5d899fae74c1752f52869b613a8210a2480e1a69688e65df6cb26117d45d/imageio-2.9.0-py3-none-any.whl Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib) Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl Collecting kiwisolver>=1.0.1 (from matplotlib) Using version 1.1.0 (newest version is 1.3.1, but Chaquopy prefers native wheels) Using cached https://chaquo.com/pypi-7.0/kiwisolver/kiwisolver-1.1.0-1-cp38-cp38-android_21_arm64_v8a.whl Collecting cycler>=0.10 (from matplotlib) Using cached https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl Collecting python-dateutil>=2.1 (from matplotlib) Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl Collecting pybind11>=2.4 (from tflite-support) Using cached https://files.pythonhosted.org/packages/8d/43/7339dbabbc2793718d59703aace4166f53c29ee1c202f6ff5bf8a26c4d91/pybind11-2.6.2-py2.py3-none-any.whl Collecting absl-py>=0.7.0 (from tflite-support) Using cached https://files.pythonhosted.org/packages/bc/58/0aa6fb779dc69cfc811df3398fcbeaeefbf18561b6e36b185df0782781cc/absl_py-0.11.0-py3-none-any.whl Collecting decorator>=4.3.0 (from networkx>=2.0->scikit-image) Using cached https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl Collecting setuptools (from kiwisolver>=1.0.1->matplotlib) Using cached https://files.pythonhosted.org/packages/15/0e/255e3d57965f318973e417d5b7034223f1223de500d91b945ddfaef42a37/setuptools-53.0.0-py3-none-any.whl Collecting six (from cycler>=0.10->matplotlib) Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl Building wheels for collected packages: tflite-support Running setup.py bdist_wheel for tflite-support: started Running setup.py bdist_wheel for tflite-support: finished with status 'error' Complete output from command /opt/anaconda3/bin/python3.8 -u -S -c "import setuptools, tokenize;file='/private/var/folders/5y/9gsj_zr101j8p9s9g4lykgt80000gp/T/pip-install-utunanpj/tflite-support/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /private/var/folders/5y/9gsj_zr101j8p9s9g4lykgt80000gp/T/pip-wheel-3s5xuave --python-tag py3: running bdist_wheel running build running build_py creating build creating build/lib.macosx-10.9-x86_64-3.8 creating build/lib.macosx-10.9-x86_64-3.8/tflite_support copying tflite_support/schema_py_generated.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support copying tflite_support/metadata.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support copying tflite_support/init.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support copying tflite_support/codegen.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support copying tflite_support/metadata_schema_py_generated.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support running egg_info writing tflite_support.egg-info/PKG-INFO writing dependency_links to tflite_support.egg-info/dependency_links.txt writing entry points to tflite_support.egg-info/entry_points.txt writing requirements to tflite_support.egg-info/requires.txt writing top-level names to tflite_support.egg-info/top_level.txt reading manifest file 'tflite_support.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'tflite_support.egg-info/SOURCES.txt' copying tflite_support/metadata_schema.fbs -> build/lib.macosx-10.9-x86_64-3.8/tflite_support creating build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/init.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/builder.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/compat.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/encode.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/number_types.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/packer.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/table.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers copying tflite_support/flatbuffers/util.py -> build/lib.macosx-10.9-x86_64-3.8/tflite_support/flatbuffers running build_ext building '_pywrap_codegen' extension error: CCompiler.compile: Chaquopy cannot compile native code


Command "/opt/anaconda3/bin/python3.8 -u -S -c "import setuptools, tokenize;file='/private/var/folders/5y/9gsj_zr101j8p9s9g4lykgt80000gp/T/pip-install-utunanpj/tflite-support/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /private/var/folders/5y/9gsj_zr101j8p9s9g4lykgt80000gp/T/pip-wheel-3s5xuave --python-tag py3" failed with error code 1 in /private/var/folders/5y/9gsj_zr101j8p9s9g4lykgt80000gp/T/pip-install-utunanpj/tflite-support/ ERROR: Failed to install tflite-support from https://files.pythonhosted.org/packages/29/97/7af9b18583d9bb01cdfcd0ab446062ef97720ebf941e33f7b156861ed179/tflite-support-0.1.0a1.tar.gz. For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues. Chaquopy: Exit status 1 Task :app:generateDebugPythonRequirements in app Finished

Task :app:generateDebugPythonRequirements FAILED :app:generateDebugPythonRequirements (Thread[Execution worker for ':',5,main]) completed. Took 20.881 secs.

FAILURE: Build failed with an exception.

BUILD FAILED in 21s 5 actionable tasks: 1 executed, 4 up-to-date

mhsmith commented 3 years ago

tflite-runtime is now available for Chaquopy: see instructions in #332.