Path: blob/main/doc/how_to/desktop_or_mobile/pywebview.md
3390 views
Create Desktop Apps with pywebview
Convert Panel applications into standalone desktop executables using pywebview and package them for distribution.
Install Dependencies
:::{note} Linux requires additional GTK dependencies. See pywebview installation guide. :::
Create Your Panel Application
We'll build a simple Panel application with optional exit functionality:
a slider to choose a number
a corresponding row of ⭐ characters
an Exit button that terminates the desktop application
The full implementation of this Panel app (via a create_app() function) is shown in the complete app.py example in the next section.
Wrap with pywebview
Create app.py to wrap your Panel application:
:::{note} You can serve an external file instead of a function:
:::
Test the Application
Run:
The app should look like:

Verify all functionality works before packaging.
Package for Distribution
Packaging frameworks by desktop platform:
Windows/Linux: PyInstaller or Nuitka
macOS: py2app
See the pywebview freezing guide for complete platform-specific instructions.
Package for Windows
Build with PyInstaller:
The executable will be in the dist folder.
Options:
--debug all- Enable debugging--icon=favicon.ico- Add custom icon (download Panel icon)--noconsole- Hide console window--onefile- Create single executable (makes the loading of the application slow)
Package for MacOS
On OSX you will need py2app instead of pyinstaller. Begin by generating a setup.py for your application with
Next build it with:
:::note py2app bundles your local environment, since conda uses features not supported in a packaged application you cannot use a conda environment as your build environment. :::
Troubleshooting
Blank window or errors:
Add hidden imports:
--hidden-import=panel --hidden-import=bokehRun without
--noconsoleto see error messages
Create installer for Windows
For professional distribution, create an installer using InstallForge, NSIS, or Inno Setup.
Alternative: Distribute as UV Tool
A simple alternative to PyInstaller, would be to distribute the app as a uv tool.