Skip to content

bug: Flet & Qdrant: Created app runs a second blank window if qdrant vector store is initiated (non builded app dont show a second window) #5528

Closed

Description

@NiTRoeSE

Duplicate Check

Describe the bug

Hello, i use qdrant vector store in a project, so far it runs fine, but once the app has been created using flet build, a second window without content opens when the vectore store is initialized. The window does not appear unless the app has been built and running with flet run or python main.py.

I cannot find any error messages in logs or console, and apart from the fact that the second window opens, the app runs without errors.

Image

For better clarity, I have created the following small code example.

I don't understand why a second window opens and hope someone can help me out or fix this behavior.

Kind regards & thanks in advanced.

Code sample

Code
  • main.py
    import flet as ft
    from langchain_qdrant import QdrantVectorStore
    from qdrant_client import QdrantClient
    from qdrant_client.models import VectorParams, Distance
    from langchain_nomic import NomicEmbeddings
    
    
    def main(page: ft.Page):
        page.title = "Qdrant Vector DB TEST"
    
    
        embeddings = NomicEmbeddings(
                model="nomic-embed-text-v1.5",
                inference_mode="local",
                device="cpu",
            )
    
    
        vector_client = QdrantClient(path="./qdrant")
    
        if not vector_client.collection_exists("langchain"):
            vector_client.create_collection(
            collection_name="langchain",
            vectors_config=VectorParams(size=768, distance=Distance.COSINE),
        )
            
        def init_qdrant_vectore_store(e):
            vector_store = QdrantVectorStore(
                client=vector_client,
                collection_name="langchain",
                embedding=embeddings,
            )
            text.value = "Qdrant-VectoreStore initiated..."
            text.update()
            return vector_store
        
        button = ft.FilledButton(
                    "Init VectorStore",
                    icon=ft.Icons.DELETE_FOREVER,
                    on_click=init_qdrant_vectore_store,
                    
                )
        text = ft.Text("")
        
        page.add(button)
        page.add(text)
        page.update()
    
    ft.app(target=main)    
  • requirements.txt
flet
langchain_qdrant
qdrant_client
langchain_nomic
gpt4all

Build with: flet build macos --copyright "QdrantTest" --project "QdrantTest" --company "QdrantTest" --build-version 0.1'

To reproduce

  • create main.py from example
  • create requirements.txt from example
  • create environment, install python modules, run and build app..
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

flet run (second window didnt appear)
flet build macos --copyright "QdrantTest" --project "QdrantTest" --company "QdrantTest" --build-version 0.1 (run the created app --> second window appear)

Expected behavior

App should not show a second blank window if qdrant vector store is initiated.

Screenshots / Videos

Captures Image

Operating System

macOS

Operating system details

15.6

Flet version

28.3.0

Regression

I'm not sure / I don't know

Suggestions

I dont know..

Logs

Logs

Additional details

Qdrant client didnt work in created (build) flet app on windows, app fails because of an import error from pywin32. So the example can only be testet on macos or linux.

Activity

  1. ndonkoHenri commented on Sep 4, 2026

    @ndonkoHenri
    Contributor

    This is now resolved in Flet 0.86.0 (#6662). Docs: https://flet.dev/docs/cookbook/multiprocessing

    Packaged desktop apps now detect Python multiprocessing child invocations before Flutter starts and run them using a headless embedded Python interpreter, so helper processes no longer open additional Flet windows.

    Despite appearances, Qdrant isn't the cause here. QdrantVectorStore(...) validates the collection by embedding a dummy text, and that is the first call that actually runs local Nomic inference — which is why the window appeared at vector store initialization rather than at startup. nomic wraps that call in a tqdm progress bar, tqdm creates a multiprocessing.RLock(), and that starts CPython's multiprocessing resource tracker, which re-executes sys.executable. In a packaged app sys.executable is your app's own binary, so it launched a second, blank instance of the app. That also explains the two things that made this hard to diagnose: nothing was written to the logs, and flet run / python main.py were unaffected, since there sys.executable is a real Python interpreter.

    Please upgrade to Flet 0.86.0 or newer and rebuild the macOS app — the second window should be gone with no changes to your code. The if __name__ == "__main__": guard isn't required for this particular case, because the resource tracker never imports your app module, but it's worth adding if you later use multiprocessing directly.

    Regarding the pywin32 import error you mention on Windows: that's a separate, unrelated issue. qdrant-client depends on portalocker, which requires pywin32 there. It's tracked in #5071 and #4737 — please follow up in those.

    Let know if you still face any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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