Considering panel for a gui: can I package as an exe?


Considering learning this framework to develop a gui for my python command line code. My code is computationally intensive. I want to use the gui for setting up problems, and looking at results. Results will be mainly plots and spreadsheet-type views.

Once the gui is developed, while I’m fine with users needing a supported/modern browser to use the gui, I will want to distribute a single .exe (on windows/mac/linux some may not have internet access) with all the dependencies. Can this be done? Is that fully supported? Thanks

Hi, I’d really appreciate any thoughts on the above?

Maybe Using Panel in Pyodide & PyScript — Panel v1.3.8 to use offline.

Thank you for your reply. I’m very new to this - I had wondered if there was something such as pyinstaller that could have produced an .exe file. Is that doable? The link you’ve provided discusses things that are beyond me at the moment so I don’t really understand the content of that page.

I don’t know; my recommendation is to create a simple panel example and try packaging it into an exe!

import panel as pn


pn.pane.Markdown("Hello world").show()

Once you do, feel free to report back and share the results with the community so everyone can learn :slight_smile:

1 Like


I’ve managed to resolve this on Linux. I created a wheel for my Panel App by using the following

from setuptools import setup, find_packages

    extra_requires={'dev': ['twine>=4.0.2']},
        'Programming Language :: Python :: 3',

Note: the key idea is to put and in the scripts section in order to have them available in your $PATH later.

Note that the is a shell script that will launch the panel app. In my case, it looks like this:

#! /usr/bin/bash

panel serve --show $(dirname $0)/

The $(dirname $0) will get the current path from the script (wich is the same for

Then, I created the wheel file:

python bdist_wheel sdist

At this point, there will be a wheel file created in the dist directory. Now you can upload it to PyPi or use it for a local installation. To test, I created another environment (make sure to have all the packages dependencies installed) and installed the wheel:

pip install --force-reinstall myapp.whl

Note: I used the --force-reinstall to ensure that the modifications I made elsewhere would take effect upon installation.

With the wheel file installed within an appropriated environment, I could launch from elsewhere on my computer.

I’m not sure, but this seems more like a makeshift solution than an adequate one for what it is intented for, but it works in my case.

Caveats: in this way, both and will be included in your $PATH, which is not ideal, since we just want

1 Like

Check out entry points too so you can define it as whatever you want.

From chatgpt:

Using entry_points in Python allows you to define entry points in your package so that external scripts or other packages can easily invoke your code. This is commonly used for creating command-line interfaces (CLI) that can be called from anywhere once the package is installed.

Here’s a step-by-step guide on how to use entry_points to call a CLI from anywhere:

  1. Define the CLI function: First, you need to create the function that will serve as your CLI. This function typically parses command-line arguments and performs the desired actions.

    # mypackage/
    import argparse
    def main():
        parser = argparse.ArgumentParser(description='Description of your CLI tool')
        # Add arguments and options to the parser
        parser.add_argument('input', help='Input argument')
        args = parser.parse_args()
        # Your CLI logic here
        print("Input:", args.input)
    if __name__ == '__main__':
  2. Update In your file, define the entry point for your CLI using the console_scripts key.

    from setuptools import setup, find_packages
            'console_scripts': [
                'mycli = mypackage.cli:main'

    In this example, mycli is the name of the command that users will run to invoke your CLI, and mypackage.cli:main specifies the function main within the cli module of the mypackage package.

  3. Install the package: You can now install your package using pip.

    pip install .
  4. Run the CLI: Once installed, users can run your CLI from anywhere by typing the command specified in the entry point (mycli in this example) followed by any necessary arguments.

    mycli argument

This setup allows users to easily invoke your CLI command from any directory once your package is installed, making it accessible from anywhere in the system.