chaquo / chaquopy

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

Error Installing mmdet (No module named 'numpy') #413

Closed AngSoonKim closed 3 years ago

AngSoonKim commented 3 years ago

Hi I wanted to try to use mmdet on android but when I pip install mmdet it gives and error of "No module named 'numpy'"

Is there a way to overcome this issue or it is not within what I am able to do on my end?

I pip install mmcv-full,numpy,cython,matplotlib,torch and mmdet. Only when mmdet is added, it fail to run.

> Configure project :app
Warning: This version of Chaquopy has not been tested with Android Gradle plugin versions beyond 4.0.0. If you experience problems, please edit the version of com.android.tools.build:gradle in your top-level build.gradle file. See https://chaquo.com/chaquopy/doc/current/versions.html.

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:extractPythonBuildPackages UP-TO-DATE

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for armeabi-v7a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting mmcv-full
Collecting numpy
  Using version 1.17.4 (newest version is 1.19.4, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/numpy/numpy-1.17.4-3-cp38-cp38-android_16_armeabi_v7a.whl
Collecting cython
  Using cached https://files.pythonhosted.org/packages/ad/4b/9e53bcce3c959fd0db143626e573210bba07be810fe8d7296373948c4183/Cython-0.29.21-py2.py3-none-any.whl
Collecting matplotlib
  Using version 3.1.2 (newest version is 3.3.3, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/matplotlib/matplotlib-3.1.2-1-cp38-cp38-android_16_armeabi_v7a.whl
Collecting torch
  Using cached https://chaquo.com/pypi-7.0/torch/torch-1.4.0-2-cp38-cp38-android_16_armeabi_v7a.whl
Collecting mmdet
  Using cached https://files.pythonhosted.org/packages/73/b5/92cb974f97835d73e1ca382fbaee3ee1d903f2a42689a6a02d3291c54f2c/mmdet-2.7.0-py3-none-any.whl
Collecting pyyaml (from mmcv-full)
Collecting opencv-python>=3 (from mmcv-full)
  Using version 4.1.2.30 (newest version is 4.4.0.46, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/opencv-python/opencv_python-4.1.2.30-1-cp38-cp38-android_16_armeabi_v7a.whl
Collecting Pillow (from mmcv-full)
  Using version 7.1.2 (newest version is 8.0.1, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/pillow/Pillow-7.1.2-0-cp38-cp38-android_16_armeabi_v7a.whl
Collecting yapf (from mmcv-full)
  Using cached https://files.pythonhosted.org/packages/c1/5d/d84677fe852bc5e091739acda444a9b6700ffc6b11a21b00dd244c8caef0/yapf-0.30.0-py2.py3-none-any.whl
Collecting addict (from mmcv-full)
  Using cached https://files.pythonhosted.org/packages/6a/00/b08f23b7d7e1e14ce01419a467b583edbb93c6cdb8654e54a9cc579cd61f/addict-2.4.0-py3-none-any.whl
Collecting chaquopy-openblas>=0.2.20 (from numpy)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-openblas/chaquopy_openblas-0.2.20-5-py3-none-android_16_armeabi_v7a.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_16_armeabi_v7a.whl
Collecting chaquopy-freetype>=2.9.1 (from matplotlib)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-freetype/chaquopy_freetype-2.9.1-1-py3-none-android_16_armeabi_v7a.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 chaquopy-libcxx>=7000 (from matplotlib)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-7000-2-py3-none-android_16_armeabi_v7a.whl
Collecting chaquopy-libpng>=1.6.34 (from matplotlib)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libpng/chaquopy_libpng-1.6.34-1-py3-none-android_16_armeabi_v7a.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 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 chaquopy-libgfortran>=4.9 (from torch)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libgfortran/chaquopy_libgfortran-4.9-0-py3-none-android_16_armeabi_v7a.whl
Collecting mmpycocotools (from mmdet)
  Using cached https://files.pythonhosted.org/packages/99/51/1bc1d79f296347eeb2d1a2e0606885ab1e4682833bf275fd39c189952e26/mmpycocotools-12.0.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-2e2_32zy/mmpycocotools/setup.py", line 1, in <module>
        import numpy as np
    ModuleNotFoundError: No module named 'numpy'
mhsmith commented 3 years ago

The current version of mmdet (2.7.0) depends on mmpycocotools, which isn't currently available for Chaquopy. However, you may be able to work around this by using an older version. Try changing your install line to mmdet==2.3.0.

AngSoonKim commented 3 years ago

Thank you very much I am able to build it successfully using mmdet==2.3.0 I will try to see if I can still get the function I needed from mmdet. Thank you once again for your help.