Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown issue for Chaquopy to process torchvision #1191

Closed
swchen7 opened this issue Jun 28, 2024 · 2 comments
Closed

Unknown issue for Chaquopy to process torchvision #1191

swchen7 opened this issue Jun 28, 2024 · 2 comments

Comments

@swchen7
Copy link

swchen7 commented Jun 28, 2024

Chaquopy version : 15.0.1

Relevant parts of your build.gradle file

chaquopy {
    defaultConfig {
        buildPython("C:/Users/swchen7-c/Python39/Python.exe")
        version = "3.9"
        pip {
            options ("--extra-index-url", "https://pypi.tuna.tsinghua.edu.cn/simple/")
            install("torchvision-0.18.1+cpu-cp39-cp39-win_amd64.whl")
            install("torch-2.3.1-cp39-cp39-win_amd64.whl")
            install("-r", "requirements.txt")
            install("onnx-1.16.1-cp39-cp39-win_amd64.whl")
            install("pyclipper-1.3.0.post5-cp39-cp39-win_amd64.whl")
            install("opencv_python-4.10.0.84-cp37-abi3-win_amd64.whl")
            install("MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl")
            install("Polygon3-3.0.9.1-cp39-cp39-win_amd64.whl")
            install("psutil-6.0.0-cp37-abi3-win_amd64.whl")
            install("numpy-1.24.4-cp39-cp39-win_amd64.whl")
            install("aiohttp-3.9.5-cp39-cp39-win_amd64.whl")
            install("mkl-2021.4.0-py2.py3-none-win_amd64.whl")
            install("onnxruntime-1.18.0-cp39-cp39-win_amd64.whl")
            install("tbb-2021.13.0-py3-none-win_amd64.whl")
            install("intel_openmp-2021.4.0-py2.py3-none-win_amd64.whl")
        }
    }
    sourceSets {
        getByName("main") {
            srcDir("src/main/python")
        }
    }
    android {
        namespace = "com.example.tccmatrixapp"
        compileSdk = 34

        defaultConfig {
            applicationId = "com.example.tccmatrixapp"
            minSdk = 28
            targetSdk = 34
            versionCode = 1
            versionName = "1.0"

            testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
            vectorDrawables {
                useSupportLibrary = true
            }
            ndk {
                // On Apple silicon, you can omit x86_64.
                abiFilters += listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64")
            }
        }

Describe your issue

I installed torchvision by .whl but don't know why there is a problem says that failed to process, but it was installed successfully.
Because Chaquopy can not run native code and could not find torchvision== 0.18.1 so i use whl method

@swchen7
Copy link
Author

swchen7 commented Jun 28, 2024

build log:
Installing collected packages: chaquopy-libjpeg, chaquopy-freetype, pillow, numpy, typing-extensions, MarkupSafe, jinja2, mpmath, sympy, filelock, networkx, fsspec, torch, torchvision, protobuf, onnx, pyclipper, opencv-python, Polygon3, psutil, multidict, attrs, idna, yarl, frozenlist, async-timeout, aiosignal, aiohttp, intel-openmp, tbb, mkl, flatbuffers, humanfriendly, coloredlogs, packaging, onnxruntime, tqdm, chaquopy-libcxx, contourpy, cycler, chaquopy-libpng, kiwisolver, fonttools, pyparsing, six, python-dateutil, matplotlib, pytz, pandas, seaborn, ultralytics-thop, pyyaml, py-cpuinfo, chaquopy-libgfortran, chaquopy-openblas, scipy, urllib3, charset-normalizer, certifi, requests, ultralytics, setuptools, lightning-utilities, torchmetrics, pytorch-lightning, unidecode, chaquopy-geos, shapely, click, huggingface-hub, cnstd, setproctitle, docker-pycreds, platformdirs, sentry-sdk, smmap, gitdb, gitpython, wandb, cnocr, colorama, zipp, importlib-resources, pyreadline3
Successfully installed MarkupSafe-2.1.5 Polygon3-3.0.9.1 aiohttp-3.9.5 aiosignal-1.3.1 async-timeout-4.0.3 attrs-23.2.0 certifi-2024.6.2 chaquopy-freetype-2.9.1 chaquopy-geos-3.8.1 chaquopy-libcxx-11000 chaquopy-libgfortran-4.9 chaquopy-libjpeg-1.5.3 chaquopy-libpng-1.6.34 chaquopy-openblas-0.2.20 charset-normalizer-3.3.2 click-8.1.7 cnocr-2.3.0.3 cnstd-1.2.4.2 colorama-0.4.6 coloredlogs-15.0.1 contourpy-1.0.5 cycler-0.12.1 docker-pycreds-0.4.0 filelock-3.15.4 flatbuffers-24.3.25 fonttools-4.53.0 frozenlist-1.4.1 fsspec-2024.6.1 gitdb-4.0.11 gitpython-3.1.43 huggingface-hub-0.23.4 humanfriendly-10.0 idna-3.7 importlib-resources-6.4.0 intel-openmp-2021.4.0 jinja2-3.1.4 kiwisolver-1.4.5 lightning-utilities-0.11.3.post0 matplotlib-3.6.0 mkl-2021.4.0 mpmath-1.3.0 multidict-6.0.5 networkx-3.2.1 numpy-1.24.4 onnx-1.16.1 onnxruntime-1.18.0 opencv-python-4.10.0.84 packaging-24.1 pandas-1.5.0 pillow-9.2.0 platformdirs-4.2.2 protobuf-5.27.2 psutil-6.0.0 py-cpuinfo-9.0.0 pyclipper-1.3.0.post5 pyparsing-3.1.2 pyreadline3-3.4.1 python-dateutil-2.9.0.post0 pytorch-lightning-2.3.1 pytz-2024.1 pyyaml-6.0.1 requests-2.32.3 scipy-1.8.1 seaborn-0.13.2 sentry-sdk-2.7.1 setproctitle-1.3.3 setuptools-70.1.1 shapely-1.8.5 six-1.16.0 smmap-5.0.1 sympy-1.12.1 tbb-2021.13.0 torch-2.3.1 torchmetrics-1.4.0.post0 torchvision-0.18.1+cpu tqdm-4.66.4 typing-extensions-4.12.2 ultralytics-8.2.45 ultralytics-thop-2.0.0 unidecode-1.3.8 urllib3-2.2.2 wandb-0.17.3 yarl-1.9.4 zipp-3.19.2
Chaquopy: Failed to process C:\Users\swchen7-c\AndroidStudioProjects\TCCMatrixApp\app\build\python\pip\debug\arm64-v8a\torchvision-0.18.1+cpu.dist-info
Traceback (most recent call last):
File "C:\Users\swchen7-c\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\swchen7-c\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\swchen7-c\AndroidStudioProjects\TCCMatrixApp\app\build\python\env\debug\lib\site-packages\chaquopy\pip_install.py", line 362, in
PipInstall().main()
File "C:\Users\swchen7-c\AndroidStudioProjects\TCCMatrixApp\app\build\python\env\debug\lib\site-packages\chaquopy\pip_install.py", line 58, in main
req_infos, abi_trees[abi] = self.pip_install(abi, self.reqs)
File "C:\Users\swchen7-c\AndroidStudioProjects\TCCMatrixApp\app\build\python\env\debug\lib\site-packages\chaquopy\pip_install.py", line 150, in pip_install
value = (hash_str, int(size_str))
ValueError: invalid literal for int() with base 10: ''

Task :app:generateDebugPythonRequirements FAILED
Execution failed for task ':app:generateDebugPythonRequirements'.
Process 'command 'C:\Users\swchen7-c\AndroidStudioProjects\TCCMatrixApp\app\build\python\env\debug\Scripts\python.exe'' finished with non-zero exit value 1

@mhsmith
Copy link
Member

mhsmith commented Jun 28, 2024

Windows wheels will not work on Android. The only Android wheels that are currently available for Torchvision are those in our repository. To use them, you'll need to change your Python version from 3.9 to 3.8.

In other words, replace your entire chaquopy block with this:

chaquopy {
    defaultConfig {
        buildPython("C:/Users/swchen7-c/Python39/Python.exe")
        version = "3.8"
        pip {
            options ("--extra-index-url", "https://pypi.tuna.tsinghua.edu.cn/simple/")
            install("torchvision")
            install("-r", "requirements.txt")
        }
    }
}

Our current latest torchvision version is 0.9.1. If you need a newer version, see #758.

Some of the other packages you attempted to install are unavailable, such as onnx (#216). Please search this issue tracker for more information on them.

@mhsmith mhsmith closed this as completed Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants