2

我正在构建一个集成了python的android应用程序。我使用 chaquopy 将 python 与 android 集成。我已经为它安装了 TensorFlow 2.2 和 python 版本 3.6.6。它会安装所有其他 python 库,但在查看日志后,它会在安装 TensorFlow 2.1.0 时报告此错误。

Process 'command 'C:\Users\Armani\AppData\Local\Programs\Python\Python36\python.exe'' 以非零退出值 1 结束

附上完整的构建日志。请帮我解决这个错误。

Executing tasks: [:app:assembleDebug] in project E:\fyp_screens
>Configure project :app 
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

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

> Task :app:generateDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting six
  Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting nltk
Collecting tensorflow
  Using cached https://chaquo.com/pypi-7.0/tensorflow/tensorflow-2.1.0-9-cp38-cp38-android_21_arm64_v8a.whl
Collecting tqdm (from nltk)
  Using cached https://files.pythonhosted.org/packages/f3/76/4697ce203a3d42b2ead61127b35e5fcc26bba9a35c03b32a2bd342a4c869/tqdm-4.46.1-py2.py3-none-any.whl
Collecting click (from nltk)
  Using cached https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl
Collecting joblib (from nltk)
  Using cached https://files.pythonhosted.org/packages/b8/a6/d1a816b89aa1e9e96bcb298eb1ee1854f21662ebc6d55ffa3d7b3b50122b/joblib-0.15.1-py3-none-any.whl
Collecting regex (from nltk)
  Using version 2020.1.8 (newest version is 2020.6.8, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/regex/regex-2020.1.8-0-cp38-cp38-android_21_arm64_v8a.whl
Collecting tensorboard<2.2.0,>=2.1.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/d9/41/bbf49b61370e4f4d245d4c6051dfb6db80cec672605c91b1652ac8cc3d38/tensorboard-2.1.1-py3-none-any.whl
Collecting keras-applications>=1.0.8 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/71/e3/19762fdfc62877ae9102edf6342d71b28fbfd9dea3d2f96a882ce099b03f/Keras_Applications-1.0.8-py3-none-any.whl
Collecting gast==0.2.2 (from tensorflow)
Collecting numpy<2.0,>=1.16.0 (from tensorflow)
  Using version 1.17.4 (newest version is 1.18.5, 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 keras-preprocessing>=1.1.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/79/4c/7c3275a01e12ef9368a892926ab932b33bb13d55794881e3573482b378a7/Keras_Preprocessing-1.1.2-py2.py3-none-any.whl
Collecting wheel>=0.26; python_version >= "3" (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting grpcio>=1.8.6 (from tensorflow)
  Using version 1.26.0 (newest version is 1.29.0, but Chaquopy prefers native wheels)
  Using cached https://chaquo.com/pypi-7.0/grpcio/grpcio-1.26.0-1-cp38-cp38-android_21_arm64_v8a.whl
Collecting astor>=0.6.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/c3/88/97eef84f48fa04fbd6750e62dcceafba6c63c81b7ac1420856c8dcc0a3f9/astor-0.8.1-py2.py3-none-any.whl
Collecting google-pasta>=0.1.6 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl
Collecting opt-einsum>=2.3.2 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/63/a5/e6c07b08b934831ccb8c98ee335e66b7761c5754ee3cabfe4c11d0b1af28/opt_einsum-3.2.1-py3-none-any.whl
Collecting tensorflow-estimator<2.2.0,>=2.1.0rc0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/18/90/b77c328a1304437ab1310b463e533fa7689f4bfc41549593056d812fab8e/tensorflow_estimator-2.1.0-py2.py3-none-any.whl
Collecting wrapt>=1.11.1 (from tensorflow)
Collecting protobuf>=3.8.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/47/90/27eac528bb6871336e86ed8bcbb72a9b412a4020bf69bb7be71d40e5eab0/protobuf-3.12.2-py2.py3-none-any.whl
Collecting chaquopy-libcxx>=7000 (from tensorflow)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-7000-2-py3-none-android_21_arm64_v8a.whl
Collecting absl-py>=0.7.0 (from tensorflow)
Collecting termcolor>=1.1.0 (from tensorflow)
Collecting setuptools>=41.0.0 (from tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/95/95/f657b6e17f00c3f35b5f68b10e46c3a43af353d8856bd57bfcfb1dbb3e92/setuptools-47.1.1-py3-none-any.whl
Collecting markdown>=2.6.8 (from tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/a4/63/eaec2bd025ab48c754b55e8819af0f6a69e2b1e187611dd40cbbe101ee7f/Markdown-3.2.2-py3-none-any.whl
Collecting werkzeug>=0.11.15 (from tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/cc/94/5f7079a0e00bd6863ef8f1da638721e9da21e5bacee597595b318f71d62e/Werkzeug-1.0.1-py2.py3-none-any.whl
Collecting google-auth-oauthlib<0.5,>=0.4.1 (from tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/7b/b8/88def36e74bee9fce511c9519571f4e485e890093ab7442284f4ffaef60b/google_auth_oauthlib-0.4.1-py2.py3-none-any.whl
Collecting requests<3,>=2.21.0 (from tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl
Collecting google-auth<2,>=1.6.3 (from tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/4d/0e/a67880c055a835eee920ab0aba6a968ec954941c923ab36186586ac56896/google_auth-1.16.1-py2.py3-none-any.whl
Collecting h5py (from keras-applications>=1.0.8->tensorflow)
  Using cached https://chaquo.com/pypi-7.0/h5py/h5py-2.10.0-1-cp38-cp38-android_21_arm64_v8a.whl
Collecting chaquopy-openblas>=0.2.20 (from numpy<2.0,>=1.16.0->tensorflow)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-openblas/chaquopy_openblas-0.2.20-5-py3-none-android_21_arm64_v8a.whl
Collecting requests-oauthlib>=0.7.0 (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/a3/12/b92740d845ab62ea4edf04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-any.whl
Collecting idna<3,>=2.5 (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl
Collecting chardet<4,>=3.0.2 (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/98/99/def511020aa8f663d4a2cfaa38467539e864799289ff354569e339e375b1/certifi-2020.4.5.2-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl
Collecting cachetools<5.0,>=2.0.0 (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/b3/59/524ffb454d05001e2be74c14745b485681c6ed5f2e625f71d135704c0909/cachetools-4.1.0-py3-none-any.whl
Collecting rsa<4.1,>=3.1.4 (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/02/e5/38518af393f7c214357079ce67a317307936896e961e35450b70fad2a9cf/rsa-4.0-py2.py3-none-any.whl
Collecting pyasn1-modules>=0.2.1 (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl
Collecting chaquopy-hdf5>=1.10.2 (from h5py->keras-applications>=1.0.8->tensorflow)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-hdf5/chaquopy_hdf5-1.10.2-1-py3-none-android_21_arm64_v8a.whl
Collecting chaquopy-libgfortran>=4.9 (from chaquopy-openblas>=0.2.20->numpy<2.0,>=1.16.0->tensorflow)
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libgfortran/chaquopy_libgfortran-4.9-0-py3-none-android_21_arm64_v8a.whl
Collecting oauthlib>=3.0.0 (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/05/57/ce2e7a8fa7c0afb54a0581b14a65b56e62b5759dbc98e80627142b8a3704/oauthlib-3.1.0-py2.py3-none-any.whl
Collecting pyasn1>=0.1.3 (from rsa<4.1,>=3.1.4->google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow)
  Using cached https://files.pythonhosted.org/packages/62/1e/a94a8d635fa3ce4cfc7f506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl
Installing collected packages: six, tqdm, click, joblib, regex, nltk, absl-py, setuptools, chaquopy-libcxx, grpcio, markdown, werkzeug, cachetools, pyasn1, rsa, pyasn1-modules, google-auth, oauthlib, idna, chardet, certifi, urllib3, requests, requests-oauthlib, google-auth-oauthlib, wheel, chaquopy-libgfortran, chaquopy-openblas, numpy, protobuf, tensorboard, chaquopy-hdf5, h5py, keras-applications, gast, keras-preprocessing, astor, google-pasta, opt-einsum, tensorflow-estimator, wrapt, termcolor, tensorflow
Successfully installed absl-py-0.9.0 astor-0.8.1 cachetools-4.1.0 certifi-2020.4.5.2 chaquopy-hdf5-1.10.2 chaquopy-libcxx-7000 chaquopy-libgfortran-4.9 chaquopy-openblas-0.2.20 chardet-3.0.4 click-7.1.2 gast-0.2.2 google-auth-1.16.1 google-auth-oauthlib-0.4.1 google-pasta-0.2.0 grpcio-1.26.0 h5py-2.10.0 idna-2.9 joblib-0.15.1 keras-applications-1.0.8 keras-preprocessing-1.1.2 markdown-3.2.2 nltk-3.5 numpy-1.17.4 oauthlib-3.1.0 opt-einsum-3.2.1 protobuf-3.12.2 pyasn1-0.4.8 pyasn1-modules-0.2.8 regex-2020.1.8 requests-2.23.0 requests-oauthlib-1.3.0 rsa-4.0 setuptools-47.1.1 six-1.15.0 tensorboard-2.1.1 tensorflow-2.1.0 tensorflow-estimator-2.1.0 termcolor-1.1.0 tqdm-4.46.1 urllib3-1.25.9 werkzeug-1.0.1 wheel-0.34.2 wrapt-1.12.1
Chaquopy: Installing for armeabi-v7a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0
Collecting chaquopy-hdf5==1.10.2
  Using cached https://chaquo.com/pypi-7.0/chaquopy-hdf5/chaquopy_hdf5-1.10.2-1-py3-none-android_16_armeabi_v7a.whl
Collecting chaquopy-libcxx==7000
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-7000-2-py3-none-android_16_armeabi_v7a.whl
Collecting chaquopy-libgfortran==4.9
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libgfortran/chaquopy_libgfortran-4.9-0-py3-none-android_16_armeabi_v7a.whl
Collecting chaquopy-openblas==0.2.20
  Using cached https://chaquo.com/pypi-7.0/chaquopy-openblas/chaquopy_openblas-0.2.20-5-py3-none-android_16_armeabi_v7a.whl
Collecting grpcio==1.26.0
  Using cached https://chaquo.com/pypi-7.0/grpcio/grpcio-1.26.0-1-cp38-cp38-android_16_armeabi_v7a.whl
Collecting h5py==2.10.0
  Using cached https://chaquo.com/pypi-7.0/h5py/h5py-2.10.0-1-cp38-cp38-android_16_armeabi_v7a.whl
Collecting numpy==1.17.4
  Downloading https://chaquo.com/pypi-7.0/numpy/numpy-1.17.4-3-cp38-cp38-android_16_armeabi_v7a.whl (3.6MB)
Collecting regex==2020.1.8
  Using cached https://chaquo.com/pypi-7.0/regex/regex-2020.1.8-0-cp38-cp38-android_16_armeabi_v7a.whl
Collecting tensorflow==2.1.0
  Downloading https://chaquo.com/pypi-7.0/tensorflow/tensorflow-2.1.0-9-cp38-cp38-android_16_armeabi_v7a.whl (61.5MB)
Exception:
Traceback (most recent call last):
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_vendor\urllib3\response.py", line 302, in _error_catcher
    yield
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_vendor\urllib3\response.py", line 384, in read
    data = self._fp.read(amt)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 449, in read
    n = self.readinto(b)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\http\client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\basecommand.py", line 236, in main
    status = self.run(options, args)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\commands\install.py", line 310, in run
    resolver.resolve(requirement_set)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\operations\prepare.py", line 312, in prepare_linked_requirement
    progress_bar=self.progress_bar
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\download.py", line 841, in unpack_url
    progress_bar=progress_bar
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\download.py", line 678, in unpack_http_url
    progress_bar)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\download.py", line 902, in _download_http_url
    _download_url(resp, link, content_file, hashes, progress_bar)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\download.py", line 624, in _download_url
    consume(downloaded_chunks)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\utils\misc.py", line 847, in consume
    deque(iterator, maxlen=0)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\download.py", line 590, in written_chunks
    for chunk in chunks:
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\utils\ui.py", line 159, in iter
    for x in it:
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_internal\download.py", line 579, in resp_read
    decode_content=False):
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_vendor\urllib3\response.py", line 436, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_vendor\urllib3\response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "C:\Users\Armani\AppData\Local\Programs\Python\Python36\lib\contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "E:\fyp_screens\app\build\generated\python\bp.zip\pip\_vendor\urllib3\response.py", line 307, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='chaquo.com', port=443): Read timed out.
Chaquopy: Exit status 2

> Task :app:generateDebugPythonRequirements FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugPythonRequirements'.
> Process 'command 'C:\Users\Armani\AppData\Local\Programs\Python\Python36\python.exe'' finished with non-zero exit value 1
  
  To view full details in Android Studio:
  * In version 3.6 and newer, click the 'Build: failed' caption to the left of this message.
  * In version 3.5 and older, click the 'Toggle view' button to the left of this message.
  * Then scroll up to see the full output.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings

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

2 回答 2

1

此错误的搜索结果表明它很可能是由缓慢或不稳定的互联网连接引起的。尝试像这样增加网络超时:

python {
    pip {
        options "--timeout", "1000"
    }
}
于 2020-06-10T23:13:05.940 回答
1

当您尝试下载 tensorflow 库时会出现问题。

我发现了两个您可能感兴趣的链接:

于 2020-06-10T22:50:14.100 回答