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

h5py for Python 3.9 or later #918

Open
mhsmith opened this issue Jul 25, 2023 · 3 comments
Open

h5py for Python 3.9 or later #918

mhsmith opened this issue Jul 25, 2023 · 3 comments

Comments

@mhsmith
Copy link
Member

mhsmith commented Jul 25, 2023

Originally posted by @githubweather in #823 (comment)

I have fixed a few things and now have an issue regarding building h5py for cp310. But first, to clarify, I am using the original build-wheel.py and removed the show.* file, which looked like a patch file, from my fork. Sorry for that confusion. I am now building a simpler APK, and am now able to see the right numpy version 1.25.0. I had to add a wheel for hdf5 and now Android Studio execution is indicating 'No module named h5py' as seen in this log:

show.h5py.logcat.log

As such, I am trying to build a wheel file for h5py and got this error message:

show.build-wheel.h5py.log
Please let me know what this error msg means and how to approach a fix. Again, the meta.yaml files are not totally clear to me. I updated my fork to include the h5py meta.yaml I am trying to use.

If it helps, this is my current build.gradle file --

plugins {
    id 'com.android.application'
    id 'com.chaquo.python'
}

android {
    compileSdk 33

    defaultConfig {
        applicationId "com.example.pythoncalledfromandroidstudio"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

        python{
   //       version "3.8"
            version "3.10"
       //     version"3.11" -- this version fails gradle syncing so stick with v3.10
       //testing     version "3.9"
       //     version "3.8"
            pip {
            //    options "--extra-index-url","file:///Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/"
        //       install "numpy"
        //        install "hdf5"
         //       install "h5py"
                install "/Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/chaquopy-netcdf4/chaquopy_netcdf4-4.9.2-1-py3-none-android_21_x86_64.whl"
                install "/Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/cftime/cftime-1.6.2-0-cp310-cp310-android_21_x86_64.whl"
                install "/Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/netcdf4/netCDF4-1.6.4-0-cp310-cp310-android_21_x86_64.whl"
    //need cp310           install "/Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/h5py/h5py-2.10.0-1-cp38-cp38-android_21_x86_64.whl"
                install "/Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/numpy/numpy-1.25.0-0-cp310-cp310-android_21_x86_64.whl"
                install "/Users/skirby/TEMPY/home/skirby/WHEEL-TEST/chaquopy/server/pypi/dist/chaquopy-hdf5/chaquopy_hdf5-1.10.2-1-py3-none-android_21_x86_64.whl"
            }
        }

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        ndk {
       //    abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
       //    abiFilters "armeabi-v7a"
       //     abiFilters "x86"
           abiFilters "x86_64"
       //     abiFilters "arm64-v8a"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.0'
    implementation 'com.google.android.material:material:1.8.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
@mhsmith
Copy link
Member Author

mhsmith commented Jul 25, 2023

Originally posted by @githubweather in #823 (comment)

I have updated the h5py meta.yaml file in my fork, so that cython is set to 0.29.36, the latest version available. Also, I set chaquopy-hdf5 to version 1.10.2 and numpy to 1.23.3. These last 2 settings I based on what packages I saw available at https://chaquo.com/pypi-7.0. build-wheel is finding chaquopy-hdf5 version 1.10.2, but is not finding numpy version 1.23.3. Where does build-wheel.py look for the packages in the host section of meta.yaml? I'm not clear on why build-wheel successfully finds chaquopy-hdf5 1.10.2 but does not find numpy 1.23.3.

This is the log from my build-wheel.py run to try and produce a wheel file for h5py, that shows what I explain here.

show-h5py.log

I also don't have a handle on the patch file that pre-existed for h5py. Apologize for this many questions.

@mhsmith
Copy link
Member Author

mhsmith commented Jul 25, 2023

Where does build-wheel.py look for the packages in the host section of meta.yaml?

It looks in the dist directory of your local repository. Simply download the host requirements from chaquo.com into a subdirectory of dist. There's no need to build them all yourself.

I see you've also updated your meta.yaml to change the h5py version from 2.10.0 to 3.9.0. Do you actually need the new version? If all you're trying to achieve is getting a build that works with Python 3.10, I suggest you leave the version number alone for now.

@mhsmith
Copy link
Member Author

mhsmith commented Dec 6, 2023

If anyone else needs this package for Python 3.9 or later, please click the thumbs up button above, and subscribe to this issue to receive updates.

@mhsmith mhsmith added the update label Oct 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