Open ilyamiro opened 6 days ago
Try building with Flet pre-release: https://flet.dev/blog/flet-new-packaging-pre-release
Now there is dependency problem, even though pyaudio is installed, it shows this
PyAudio has binary packages for Windows only: https://pypi.org/project/PyAudio/#files
Are you able to install it on Linux machine with pip install pyaudio
?
Yes i am, my project is fully functional with pyaudio. Does this mean i can't build if my project has pyaudio in it? Because it's not the only package that has such problem.
OK, we could try removing "only binary" requirement when packaging for non-mobile platforms: https://github.com/flet-dev/serious-python/blob/main/src/serious_python/bin/package_command.dart#L300-L301
This case pip will try to compile the package from source distribution.
OK, I've modified flet build template to allow packaging for desktops from source packages (that pyaudio package still won't be working for iOS and Android anyway).
Try re-building with Flet pre-release and let me know how it worked.
I have tried building the project again on the new pre-release version .dev3526 and now i get the similar error to the one i had on 0.24.1. I have not modified anything else other than just installing a new flet version. I have a python version 3.11.10, but the cpython version being installed is 3.12, may that be an issue? Here are the logs:
flet build linux --module-name main.py --verbose
[14:43:40] No additional Flutter dependencies!
[14:43:41] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.25.0
✅
Customized app icons and splash images ✅
Run subprocess: ['/home/ilyamiro/Загрузки/flutter/bin/dart', 'run',
'flutter_launcher_icons']
( ● ) Generating app icons ⏳... Resolving dependencies in `/home/ilyamiro/stewart/build/flutt( ● ) Generating app icons (2.0s)
( ● ) Generating app icons (8.0s)
Got dependencies in `/home/ilyamiro/stewart/build/flutter`.
( ● ) Generating app icons ⏳...
Built flutter_launcher_icons:flutter_launcher_icons.
( ● ) Generating app icons ⏳... ════════════════════════════════════════════
FLUTTER LAUNCHER ICONS (v0.14.1)
════════════════════════════════════════════
( ● ) Generating app icons ⏳... • Creating default icons Android
( ● ) Generating app icons ⏳... • Overwriting the default Android launcher icon with a new icon
( ● ) Generating app icons ⏳... • Creating mipmap xml file Android
( ● ) Generating app icons ⏳... • Overwriting default iOS launcher icon with new icon
( ●) Generating app icons ⏳...done
( ● ) Generating app icons ⏳...done
( ● ) Generating app icons ⏳...done
✓ Successfully generated launcher icons
[14:43:55] Generated app icons ✅
Run subprocess: ['/home/ilyamiro/Загрузки/flutter/bin/dart', 'run',
'serious_python:main', 'package', '/home/ilyamiro/stewart', '--platform', 'Linux',
'--requirements', '-r,/home/ilyamiro/stewart/requirements.txt', '--exclude', 'build',
'--cleanup']
( ● ) Packaging Python app ⏳...
Built serious_python:main.
( ●) Packaging Python app ⏳... Running package command
Extra PyPi indexes: [https://pypi.flet.dev]
Creating asset directory: /home/ilyamiro/stewart/build/flutter/app
Created temp directory: /tmp/serious_python_tempBSMJYW
Copying Python app from /home/ilyamiro/stewart to a temp directory
( ● ) Packaging Python app ⏳... Cleanup app
( ● ) Packaging Python app ⏳... Configured Linux/ platform with sitecustomize.py
Installing [-r, /home/ilyamiro/stewart/requirements.txt] with pip command to /tmp/serious_python_tempBSMJYW/__pypackages__
Downloading Python distributive from https://github.com/indygreg/python-build-standalone/releases/download/20240909/cpython-3.12.6+20240909-x86_64-unknown-linux-gnu-install_only_stripped.tar.gz to a build directory
( ● ) Packaging Python app ⏳... Extracting Python distributive
( ● ) Packaging Python app ⏳... error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
Traceback (most recent call last):
File "/home/ilyamiro/.local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/ilyamiro/.local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilyamiro/.local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-zxcitznr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-zxcitznr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-zxcitznr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 516, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-zxcitznr/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
exec(code, locals())
File "<string>", line 6, in <module>
File "/home/ilyamiro/stewart/build/flutter/build/build_python_3.12.6/python/lib/python3.12/inspect.py", line 1285, in getsource
lines, lnum = getsourcelines(object)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/ilyamiro/stewart/build/flutter/build/build_python_3.12.6/python/lib/python3.12/inspect.py", line 1267, in getsourcelines
lines, lnum = findsource(object)
^^^^^^^^^^^^^^^^^^
File "/home/ilyamiro/stewart/build/flutter/build/build_python_3.12.6/python/lib/python3.12/inspect.py", line 1096, in findsource
raise OSError('could not get source code')
OSError: could not get source code
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[14:44:27] Error building Flet app - see the log of failed command above.
Run subprocess: ['/home/ilyamiro/Загрузки/flutter/bin/flutter', 'doctor']
[14:44:32] Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on Fedora Linux 40 (Workstation Edition)
6.10.12-200.fc40.x86_64, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.94.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
OK, few more things I need:
/home/ilyamiro/stewart/requirements.txt
PATH
variable (echo $PATH
).
Thanks.Contents of requirements.txt:
ytmusicapi==1.8.2
yt-dlp==2024.10.7
icalendar==6.0.1
python-vlc==3.0.21203
curl_cffi~=0.7.3
numpy==1.26.4
g4f~=0.3.2.7
playsound~=1.3.0
flet~=0.25.0.dev3519
pyautogui~=0.9.54
PyAudio~=0.2.14
vosk~=0.3.45
voicesynth~=0.2.2.post3
PyYAML~=6.0.2
requests~=2.32.3
num2words~=0.5.13
matplotlib~=3.9.2
pynput~=1.7.7
plyer~=2.1.0
$PATH variable:
/home/ilyamiro/.local/share/zinit/plugins/sharkdp---bat:/home/ilyamiro/.local/share/zinit/plugins/ogham---exa:/home/ilyamiro/.local/share/zinit/plugins/starship---starship:/home/ilyamiro/.local/share/zinit/plugins/junegunn---fzf-bin:/home/ilyamiro/.local/share/zinit/polaris/bin:/run/user/1000/fnm_multishells/20560_1729193580699/bin:/home/ilyamiro/.cargo/bin:/home/ilyamiro/.local/bin:/home/ilyamiro/.scripts:/home/ilyamiro/.local/share/pnpm:/home/ilyamiro/.spicetify:/home/ilyamiro/Загрузки/android-studio/bin:/home/ilyamiro/Загрузки/flutter/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/var/lib/snapd/snap/bin:/usr/local/go/bin
OK, you've got a lot in requirements.txt
.
Looking at OSError: could not get source code
error we can't tell for sure it caused by PyAudio dependency.
To find offending package I'd start with a minimal requirements.txt
, say with flet
and PyAudio
only, do flet build
and then add more deps one-by-one until it fails.
I also don't like the fact it looks into /home/ilyamiro/.local/lib/python3.12/site-packages/pip/_vendor/...
. I think we need a better isolation for flet build
command.
Is Flet on your machine installed into /home/ilyamiro/.local/lib/python3.12/site-packages
?
I am using a python version 3.11.10 (not 3.12) inside of a python virtual environment that was active when i was running flet build
. Tomorrow I will try and run with less packages in requirements, but talking about a big amount of them, I would suppose that lots of big projects with a gui component would require lot's of dependencies, and being able to build an executable for all of the platforms including Linux would be really nice. I am looking forward to helping you solve that issue.
Duplicate Check
Describe the bug
When packaging an app using
flet build linux
, an error occurs. Could not find a way to fix itCode sample
Code
```python flet build linux --verbose --module-name main.py ```To reproduce
Run
flet build linux --verbose --module-name main.py
Expected behavior
No response
Screenshots / Videos
Captures
[Upload media here]Operating System
Linux
Operating system details
Fedora Workstation 40
Flet version
0.24.1
Regression
No, it isn't
Suggestions
No response
Logs
Logs
```console flet build linux --verbose --module-name main.py ✔ ╱ stewart 18:33:31 ▓▒░ [18:33:35] Flutter bootstrap directory: /tmp/flet_flutter_build_DBJd8e3Hlo No additional Flutter dependencies! [18:33:36] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.24.1 ✅ Customized app icons and splash images ✅ Run subprocess: ['/home/ilyamiro/Загрузки/flutter/bin/dart', 'run', 'flutter_launcher_icons'] ( ● ) Generating app icons (1.7s) Downloading packages... Got dependencies in `/tmp/flet_flutter_build_DBJd8e3Hlo`. ( ● ) Generating app icons ⏳... Built flutter_launcher_icons:flutter_launcher_icons. ( ●) Generating app icons ⏳... ════════════════════════════════════════════ FLUTTER LAUNCHER ICONS (v0.13.1) ════════════════════════════════════════════ ( ● ) Generating app icons ⏳... • Creating default icons Android ( ● ) Generating app icons ⏳... • Overwriting the default Android launcher icon with a new icon (● ) Generating app icons ⏳... • Overwriting default iOS launcher icon with new icon ( ● ) Generating app icons ⏳...done (● ) Generating app icons ⏳...done ( ●) Generating app icons ⏳...done ✓ Successfully generated launcher icons [18:33:41] Generated app icons ✅ Run subprocess: ['/home/ilyamiro/Загрузки/flutter/bin/dart', 'run', 'serious_python:main', 'package', '/home/ilyamiro/stewart', '--dep-mappings', 'flet=flet-embed', '--req-deps', 'flet-embed', '--exclude', 'build'] ( ● ) Packaging Python app ⏳... Built serious_python:main. ( ● ) Packaging Python app ⏳... Running package command ( ● ) Packaging Python app ⏳... Creating asset directory: /tmp/flet_flutter_build_DBJd8e3Hlo/app Copying Python app from /home/ilyamiro/stewart to /tmp/serious_python_tempGJXSCP ( ● ) Packaging Python app ⏳... Installing dependencies [ytmusicapi==1.8.2, yt-dlp==2024.10.7, icalendar==6.0.1, python-vlc==3.0.21203, curl_cffi~=0.7.3, numpy==1.26.4, g4f~=0.3.2.7, playsound~=1.3.0, flet~=0.24.1, vosk~=0.3.45, voicesynth~=0.2.2.post3, PyAudio~=0.2.14, PyYAML~=6.0.2, requests~=2.32.3, num2words~=0.5.13, matplotlib~=3.9.2, PyAutoGUI~=0.9.54, pynput~=1.7.7, pygame~=2.6.0, plyer~=2.1.0, flet-embed] with pip command to /tmp/serious_python_tempGJXSCP/__pypackages__ Downloading Python distributive from https://github.com/indygreg/python-build-standalone/releases/download/20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz to /tmp/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz ( ● ) Packaging Python app ⏳... Extracting Python distributive from /tmp/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-install_only.tar.gz to /tmp/hostpython3.11_SVWAAC ( ● ) Packaging Python app ⏳... error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [28 lines of output] Traceback (most recent call last): File "/home/ilyamiro/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, inAdditional details
No response