Skip to content

bug: Cannot build APK with pyaes dependency in Flet. #5849

@nimaxin

Description

@nimaxin

Duplicate Check

Describe the bug

When I try to build an APK using Flet 0.28.3 with pyaes as a dependency, the build fails:

(.venv) xin@flet-build-lab:~/flet-pyaes-issue$ flet build apk
[23:03:17] Flutter 3.29.2 installed ✅                                                                                                                                     
           JDK installed ✅                                                                                                                                                
           Android SDK installed ✅                                                                                                                                        
[23:03:19] Running package command                                                                                                                                         
           Extra PyPi indexes:                                                                                                                                             
           Created temp directory: /tmp/serious_python_tempPRRUTP                                                                                                          
           Copying Python app from /home/xin/flet-pyaes-issue/src to a temp directory                                                                                      
           Configured Android/arm64-v8a platform with sitecustomize.py                                                                                                     
           Installing  with pip command to /home/xin/flet-pyaes-issue/build/site-packages/arm64-v8a                                                                        
                                                                                                                                                                           
           ERROR: Could not find a version that satisfies the requirement pyaes (from versions: none)                                                                      
           ERROR: No matching distribution found for pyaes                                                                                                                 
                                                                                                                                                                           
[23:03:21] Doctor summary (to see all details, run flutter doctor -v):                                                                                                     
           [✓] Flutter (Channel stable, 3.29.2, on Ubuntu 22.04.5 LTS 5.15.0-151-generic, locale en_US.UTF-8)                                                              
           [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)                                                                                
           [✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)                                                                               
               ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.                                                                                 
           [✗] Linux toolchain - develop for Linux desktop                                                                                                                 
               ✗ clang++ is required for Linux development.                                                                                                                
                 It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/                             
               ✗ CMake is required for Linux development.                                                                                                                  
                 It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/                            
               ✗ ninja is required for Linux development.                                                                                                                  
                 It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases    
               ✗ pkg-config is required for Linux development.                                                                                                             
                 It is likely available from your distribution (e.g.: apt install pkg-config), or can be downloaded from                                                   
           https://www.freedesktop.org/wiki/Software/pkg-config/                                                                                                           
           [!] Android Studio (not installed)                                                                                                                              
           [✓] Connected device (1 available)                                                                                                                              
           [✓] Network resources                                                                                                                                           
                                                                                                                                                                           
           ! Doctor found issues in 3 categories.                                                                                                                          
                                                                                                                                                                           
Error building Flet app - see the log of failed command above.

I can install pyaes manually with pip install pyaes, but it uses the legacy setup method:

(.venv) xin@flet-build-lab:~/flet-pyaes-issue$ pip install pyaes
Collecting pyaes
  Using cached pyaes-1.6.1.tar.gz (28 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pyaes, since package 'wheel' is not installed.
Installing collected packages: pyaes
  Running setup.py install for pyaes ... done
Successfully installed pyaes-1.6.1

It seems Flet cannot handle packages installed this way, even though pyaes is pure Python.

Code sample

# main.py
import flet as ft
import pyaes  # or any package installed via setup.py install

def main(page: ft.Page):
    page.add(ft.Text("Hello World"))

ft.app(target=main)

To reproduce

  1. Create a Flet project.
  2. Add pyaes to pyproject.toml dependencies:
dependencies = [
  "flet==0.28.3",
  "pyaes"
]
  1. Run flet build apk.
  2. See error: No matching distribution found for pyaes.

Expected behavior

Flet should detect and include packages installed via legacy setup.py install, allowing all pure Python packages to be built into APKs successfully.

Screenshots / Videos

No response

Operating System

Linux

Operating system details

Ubuntu 22.04.5 LTS

Flet version

0.28.3

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

No response

Additional details

This affects all packages that don’t provide a wheel. It seems related to how Flet packages dependencies for Android. Installing wheel or building a wheel might be a temporary workaround, but the build system should ideally handle these packages automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions