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

Package 'numpy' requires a different Python: 3.8.10 not in '>=3.9' #1295

Open
mhsmith opened this issue Nov 16, 2024 · 1 comment
Open

Package 'numpy' requires a different Python: 3.8.10 not in '>=3.9' #1295

mhsmith opened this issue Nov 16, 2024 · 1 comment

Comments

@mhsmith
Copy link
Member

mhsmith commented Nov 16, 2024

Originally posted by @Michu44 in #1289 (comment)


module build.gradle

chaquopy {
    defaultConfig {
        version = "3.10"
        pip {
            // A requirement specifier, with or without a version number:
            install "numpy"
            install "flask"
            // And more
        }
    }
}

and I get the following error log:

Warning: Python version 3.10 may have fewer packages available. If you experience problems, try switching to version 3.8.

...

Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-13.1
Collecting numpy
  Downloading https://chaquo.com/pypi-13.1/numpy/numpy-1.26.2-0-cp310-cp310-android_21_arm64_v8a.whl (5.0 MB)
ERROR: Package 'numpy' requires a different Python: 3.8.10 not in '>=3.9'
Chaquopy: Exit status 1

I realized I was using the wrong build pipeline, and Python 3.10 wasn’t installed correctly on the build machine for that workflow.

As a suggestion, perhaps there could be a clearer error message if Python is not installed in the correct version on the build machine. It might help others troubleshoot similar issues more quickly.

@mhsmith
Copy link
Member Author

mhsmith commented Nov 16, 2024

Thanks for the suggestion. We do display a warning at the pyc-compilation stage if the correct Python version is not found, but evidently it can also cause a problem when running pip, so an early warning of a version mismatch would be a good idea, along with a link to the buildPython documentation.

If anyone else sees this error, the solution is:

  • Install a version of Python on your build machine which matches the Python version used by your app. In the above example, that would be Python 3.10.
  • Remove any buildPython lines from your build.gradle file, and try rebuilding your app – Chaquopy will usually be able to find the correct Python version automatically.
  • If you still get the same error, add a buildPython line to point Chaquopy at the correct Python executable.

@mhsmith mhsmith changed the title Display early warning if correct buildPython version is not found Package 'numpy' requires a different Python: 3.8.10 not in '>=3.9' Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant