Android Studio中没有名为“numpy.core._multiarray_umath”的模块,带有chaquopy

9w11ddsr  于 11个月前  发布在  Android
关注(0)|答案(1)|浏览(100)

我想使用galois,一个在android studio中带有chaquopy的numpy扩展库。因为galois不支持chaquopy仓库中的numpy版本,我自己安装了轮子,并从那里安装了numpy。然而,当我运行应用程序时,我得到了这个错误:

com.chaquo.python.PyException: ImportError: 
                                                                                                    
                                                                                                    IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
                                                                                                    
                                                                                                    Importing the numpy C-extensions failed. This error can happen for
                                                                                                    many reasons, often due to issues with your setup or how NumPy was
                                                                                                    installed.
                                                                                                    
                                                                                                    We have compiled some common reasons and troubleshooting tips at:
                                                                                                    
                                                                                                        https://numpy.org/devdocs/user/troubleshooting-importerror.html
                                                                                                    
                                                                                                    Please note and check the following:
                                                                                                    
                                                                                                      * The Python version is: Python3.10 from "/system/bin/app_process32"
                                                                                                      * The NumPy version is: "1.25.1"
                                                                                                    
                                                                                                    and make sure that they are the versions you expect.
                                                                                                    Please carefully study the documentation linked above for further help.
                                                                                                    
                                                                                                    Original error was: No module named 'numpy.core._multiarray_umath'
                                                                                                    
                                                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3782)
                                                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922)
                                                                                                        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
                                                                                                        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
                                                                                                        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                        at android.os.Looper.loop(Looper.java:294)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
                                                                                                    Caused by: com.chaquo.python.PyException: ImportError: 
                                                                                                    
                                                                                                    IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
                                                                                                    
                                                                                                    Importing the numpy C-extensions failed. This error can happen for
                                                                                                    many reasons, often due to issues with your setup or how NumPy was
                                                                                                    installed.
                                                                                                    
                                                                                                    We have compiled some common reasons and troubleshooting tips at:
                                                                                                    
                                                                                                        https://numpy.org/devdocs/user/troubleshooting-importerror.html
                                                                                                    
                                                                                                    Please note and check the following:
                                                                                                    
                                                                                                      * The Python version is: Python3.10 from "/system/bin/app_process32"
                                                                                                      * The NumPy version is: "1.25.1"
                                                                                                    
                                                                                                    and make sure that they are the versions you expect.
                                                                                                    Please carefully study the documentation linked above for further help.
                                                                                                    
                                                                                                    Original error was: No module named 'numpy.core._multiarray_umath'
                                                                                                    
                                                                                                        at <python>.numpy.core.<module>(__init__.py:49)
                                                                                                        at <python>.java.chaquopy.import_override(import.pxi:60)
                                                                                                        at <python>.numpy.<module>(__init__.py:139)
                                                                                                        at <python>.java.chaquopy.import_override(import.pxi:60)
                                                                                                        at <python>.galois._domains._array.<module>(_array.py:11)
                                                                                                        at <python>.java.chaquopy.import_override(import.pxi:60)
                                                                                                        at <python>.galois._domains.<module>(__init__.py:4)
                                                                                                        at <python>.java.chaquopy.import_override(import.pxi:60)
                                                                                                        at <python>.galois.<module>(__init__.py:20)
                                                                                                        at <python>.java.chaquopy.import_override(import.pxi:60)
                                                                                                        at <python>.generator.<module>(generator.py:1)
                                                                                                        at <python>.importlib._bootstrap._call_with_frames_removed(<frozen importlib._bootstrap>:241)
                                                                                                        at <python>.importlib._bootstrap_external.exec_module(<frozen importlib._bootstrap_external>:883)
                                                                                                        at <python>.java.android.importer.exec_module(.\java\android\importer.py:545)
                                                                                                        at <python>.java.android.importer.exec_module(.\java\android\importer.py:597)
                                                                                                        at <python>.importlib._bootstrap._load_unlocked(<frozen importlib._bootstrap>:688)
                                                                                                        at <python>.importlib._bootstrap._find_and_load_unlocked(<frozen importlib._bootstrap>:1006)
                                                                                                        at <python>.importlib._bootstrap._find_and_load(<frozen importlib._bootstrap>:1027)
                                                                                                        at <python>.importlib._bootstrap._gcd_import(<frozen importlib._bootstrap>:1050)
                                                                                                        at <python>.importlib.import_module(__init__.py:126)

字符串
我尝试了不同的python版本和不同的numpy版本,但是只有少数numpy版本与galois兼容。

python{
            version "3.10"

            pip{

                install "galois"
                install "./libs/llvmlite-0.41.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
                install "./libs/numba-0.58.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl"
                install "./libs/numpy-1.25.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"

            }
        }

ar5n3qh5

ar5n3qh51#

Linux wheel在Android上不起作用。因此,如果您需要使用需要更新版本NumPy的软件包,您的选择是:

  • 使用与可用版本的NumPy兼容的旧版本软件包;或者
  • 使用较新版本的Python,因为Chaquopy可能有较新版本的NumPy;或者
  • 使用Chaquopy package build tool自己构建一个更新版本的NumPy。

相关问题