Chaquopy cant find numpy, even though I installed it

100 views Asked by At

I want to use the library galois, which is an extension of numpy, in an android studio project with chaquopy. To download the libraries, I added

python{
    version "3.8"

    pip{
        install "cython"
        install "numpy==1.24.4"
        install "numba==0.6.0"
        install "galois"
    }
}

into my build.gradle file. However when I try to build the package I get this error:

ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -S -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-53dg7cfr/numba/setup.py'"'"'; __file__='"'"'/tmp/pip-install-53dg7cfr/numba/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' --no-user-cfg egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-53dg7cfr/numba/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ERROR: Command errored out with exit status 1:

      File "/tmp/pip-install-53dg7cfr/numba/setup.py", line 7, in <module>
        import numpy
    ModuleNotFoundError: No module named 'numpy'

When I tried importing only numpy everything worked fine.

1

There are 1 answers

2
mhsmith On

For packages with native components such as NumPy and Numba, you can only install versions that are in the Chaquopy repository. Either change your version numbers to one of the options from there, or remove them entirely to use the newest possible versions.

As for Cython, that's a build-time tool, not a runtime tool. Since you won't be building any packages, you should probably remove it from the list.