chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
833 stars 132 forks source link

Google OR-Tools package #507

Open DiTo97 opened 3 years ago

DiTo97 commented 3 years ago

Chaquopy version

9.1

Python version

3.7.7

Gradle version

4.2.1

Relevant parts of your build.gradle file

apply plugin: 'com.android.application' apply plugin: 'com.chaquo.python'

android { compileSdkVersion 30 buildToolsVersion "30.0.2"

defaultConfig {
    python {
        // Link the Python executable
        buildPython "C:\path\to\python.exe"

        pip {
            install "numpy"
            install "ortools"
        }
    }
}

}

Describe your issue

I have possibly tried anything that I could have done following the setup guidelines in your documentation, but Google OR-Tools package won't let the Android app build by any chance; conversely, NumPy does not pose any problems.

This is the error message that I have been getting:

Could not find a version that satisfies the requirement ortools. No matching distribution found for ortools.

As you state in this section of the FAQ, https://chaquo.com/chaquopy/doc/current/faq.html#chaquopy-cannot-compile-native-code, I think the issue is that you don't have a pre-built wheel for the OR-Tools package. Am I right in saying that? Is there any chance you will add it to Chaquopy in the near future?

I could try to use OR-Tools Java library, but since the app I am developing with Chaquopy has a pretty large Python logic on its back I would prefer not to, unless there is absolutely no other way out of this.

mhsmith commented 3 years ago

Thanks for the report. This package isn't currently a priority, but I'll update this issue if we add it in the future. And if anyone else wants it too, please click the thumbs-up button above.

According to https://github.com/google/or-tools/issues/1130, OR-Tools isn't available for Java on Android either.

Have a look at the list of other packages Chaquopy supports: maybe one of them could be used as an alternative.

DiTo97 commented 3 years ago

Thanks for the report. This package isn't currently a priority, but I'll update this issue if we add it in the future. And if anyone else wants it too, please click the thumbs-up button above.

According to google/or-tools#1130, OR-Tools isn't available for Java on Android either.

Have a look at the list of other packages Chaquopy supports: maybe one of them could be used as an alternative.

Thank you, then, for taking a look at it.

Before dwelling on a client-server approach (with the Android app letting OR-Tools do the dirty work on the server), I tried to install it as a wheel since I saw you have this possibility with Chaquopy. I changed the whole configuration to match the one suggested in https://chaquo.com/chaquopy/doc/current/versions.html, moving to Python 3.8.6 and Gradle 4.1.1.

I then downloaded the wheel from https://pypi.org/project/ortools/#files with cp38 and _x8664 as tags, put it in a folder named wheels under the Android app's project root folder and asked pip to install in the build.gradle, specifying the _x8664 ABI type, similarly to what you show in the Requirements section of the Gradle setup guide.

Unfortunately I keep getting the ortools-9.0.9048-cp38-cp38-*.whl is not a supported wheel on this platform error. So, am I missing something here, or is installing a pip wheel on Chaquopy not as straightforward as I thought?

mhsmith commented 3 years ago

The only wheels that can be installed on Chaquopy are either pure-Python ones (with "none-any" in their name), or native Android ones like those in our repository.

If you'd like to try building an OR-Tools wheel for Android, you could license the package build tool which we use to build everything in our repository. The tool supports CMake, which it looks like is the recommended way of building an OR-Tools wheel. We would provide support for the tool itself, but we have no expertise in OR-Tools specifically, so it would be up to you understand their build system and deal with any package-specific issues. For more details, see https://github.com/chaquo/chaquopy/issues/175#issuecomment-778543307.

mhsmith commented 1 year ago

It's been over a year and only one person has requested this package, so we won't be adding it in the foreseeable future.

However, the package build tool is now open-source, so if you'd like to try building this package yourself, follow the instructions here. And if you're successful, please make a pull request so we can add it to the public repository.

If anyone else wants this package, please click the thumbs-up button above and post a comment, and I'll reopen the issue.

tomika commented 4 months ago

It would be nice to have an Android package

DiTo97 commented 4 months ago

@mhsmith, guess I'm no longer standing alone! 💪

tomika commented 4 months ago

You're definitely not. My only solution was to create a webservice with or-tools based backend, but this way you have to be online :/ It would be far better to solve the problem locally.

DiTo97 commented 4 months ago

@tomika, exactly how I solved back in the day.

if the optimization process is very large and complex, decentralizing it to a dedicated backend still has its place, but it would be nice to solve easier ones on edge