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

flet==0.25.0.dev3526 apk "Android" pandas error Buffer dtype mismatch, expected 'const int64_t' but got 'long long' #4199

Open
1 task done
jtoror opened this issue Oct 20, 2024 · 7 comments
Assignees
Labels
platform: android Specific to Android

Comments

@jtoror
Copy link

jtoror commented Oct 20, 2024

Duplicate Check

Describe the bug

"Android" apk does not start on physical or simulated devices when requiring the pandas library, throwing error Buffer dtype mismatch, expected 'const int64_t' but got 'long long'

Code sample

Code
pyproject.toml

[project]
name = "amy_app"
version = "1.0.0"
description = "My first Flet project"
authors = [
    {name = "John Smith", email = "john@email.com"}
]

dependencies = [
    "flet==0.25.0.dev3526",
    "numpy",
    "pandas"
]

# requires-python = ">=3.12"

icon = "assets/icon"

[tool.flet.android.permission] # --android-permissions
"android.permission.INTERNET" = true
"android.permission.CAMERA" = true
"android.permission.READ_EXTERNAL_STORAGE" = true
"android.permission.WRITE_EXTERNAL_STORAGE" = true
"android.permission.READ_MEDIA_VISUAL_USER_SELECTED" = true

main.py

import os
import flet as ft
import numpy as np
import pandas as pd

def main(page: ft.Page):
    page.title = "Flet counter example"
    page.vertical_alignment = ft.MainAxisAlignment.CENTER

    txt_number = ft.TextField(
        value="0", text_align=ft.TextAlign.RIGHT, width=100)

    def minus_click(e):
        txt_number.value = str(int(txt_number.value) - 1)
        page.update()

    def plus_click(e):
        txt_number.value = str(int(txt_number.value) + 1)
        page.update()

    page.add(
        ft.Row(
            [
                ft.IconButton(ft.icons.REMOVE, on_click=minus_click),
                txt_number,
                ft.IconButton(ft.icons.ADD, on_click=plus_click),
            ],
            alignment=ft.MainAxisAlignment.CENTER,
        )
    )


ft.app(main)

To reproduce

Traceback (most recent call last):
File "", line 43, in
File "", line 229, in run_module
File "", line 88, in _run_code
File "/data/user/0/com.flet.amy_app/files/flet/app/main.py", line 4, in
import pandas as pd
File "/data/user/0/com.flet.amy_app/files/flet/python_site_packages/pandas/init.py", line 49, in
from pandas.core.api import (
File "/data/user/0/com.flet.amy_app/files/flet/python_site_packages/pandas/core/api.py", line 1, in
from pandas.libs import (
File "/data/user/0/com.flet.amy_app/files/flet/python_site_packages/pandas/libs/init.py", line 18, in
from pandas._libs.interval import Interval
File "interval.pyx", line 1, in init pandas._libs.interval
File "hashtable.pyx", line 1, in init pandas._libs.hashtable
File "missing.pyx", line 1, in init pandas.libs.missing
File "/data/user/0/com.flet.amy_app/files/flet/python_site_packages/pandas/libs/tslibs/init.py", line 40, in
from pandas._libs.tslibs.conversion import localize_pydatetime
File "conversion.pyx", line 1, in init pandas._libs.tslibs.conversion
File "offsets.pyx", line 1, in init pandas._libs.tslibs.offsets
File "timestamps.pyx", line 1, in init pandas._libs.tslibs.timestamps
File "tzconversion.pyx", line 55, in init pandas._libs.tslibs.tzconversion
ValueError: Buffer dtype mismatch, expected 'const int64_t' but got 'long long'

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

Operating System

Linux

Operating system details

Kubuntu 24.04

Flet version

0.25.0.dev3526

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

@FeodorFitsner
Copy link
Contributor

Are you getting this error on a physical device (assuming you can't run on a simulator because of shared c++ lib issue)?

If so, what kind of device is that (brand, model)?

@jtoror
Copy link
Author

jtoror commented Oct 20, 2024

Are you getting this error on a physical device (assuming you can't run on a simulator because of shared c++ lib issue)?

If so, what kind of device is that (brand, model)?

Motorola Moto E5 Plus https://www.gsmarena.com/motorola_moto_e5_plus-9095.php

It's funny because after many days I managed to use Pandas and Matplotlib in an android app using the old way of compiling and it worked

p4a create --requirements numpy,pandas,sqlite3,requests,python-dotenv,matplotlib,cryptography,imagekitio,requests-toolbelt,urllib3 --arch arm64-v8a --arch armeabi-v7a --arch x86_64 --sdk-dir $ANDROID_SDK_ROOT --ndk-dir $ANDROID_SDK_ROOT/ndk/$NDK_VERSION --android-api 33 --ndk-api 21 --color=always --bootstrap=sdl2 --permission INTERNET, WRITE_EXTERNAL_STORAGE --dist-name android

This worked before in physical and virtual.

https://discord.com/channels/981374556059086931/1244027520722931733/1259332729913348136

Now with the dev version and the new flet build it doesn't work. I don't understand why you say something about the shared C++ lib.

@FeodorFitsner FeodorFitsner self-assigned this Oct 20, 2024
@FeodorFitsner
Copy link
Contributor

Pandas is working now in emulator: #4203 (comment)

@jtoror
Copy link
Author

jtoror commented Oct 22, 2024

image

@FeodorFitsner
Copy link
Contributor

What emulator is that? What's host machine/OS, ARM or Intel?

@jtoror
Copy link
Author

jtoror commented Oct 22, 2024

What emulator is that? What's host machine/OS, ARM or Intel?

On my phone a MOTOe5 plus https://www.gsmarena.com/motorola_moto_e5_plus-9095.php

host Intel x64

@jtoror
Copy link
Author

jtoror commented Oct 22, 2024

I deleted my .venv and build folder, created my virtual environment from scratch and created the new build.

@FeodorFitsner FeodorFitsner added the platform: android Specific to Android label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android Specific to Android
Projects
None yet
Development

No branches or pull requests

2 participants