Skip to content

dist(AppImage): unable to run models after restarting the app #210

Description

@gucio321

Describe the bug

Downloading extensions creates venv (for example Modly/extensions/hunyuan3d-mini/venv).
This venv is probably created witha python instance shipped with the app.
The default python venv creates a symlink to the parent python executable.
however, as the executable is mounted in a temporary directory, which is different every run, after the 2nd run it fails to run the old venv.

Simple fix would be to enforce copying files while venv creation with --copies

Steps to reproduce

  1. download AppImage
  2. download any model
  3. close and re-open app
  4. try to generate anything (will get error 400). Try to hit repair on a model - will see python crash caused by not existing file

Modly version

0.4.0

Operating system

Arch linux

Screenshots & logs

No response

Confirmation

  • I have searched existing issues and this has not been reported yet.
  • I can reproduce this on the latest version of Modly.

Activity

  1. novaflash commented on Aug 28, 2026

    @novaflash

    I was able to work around this problem at least with;
    ln -sfn /home/username/.config/Modly/python-embed/bin/python3.11 /home/username/Documents/Modly/modelname/venv/bin/python3.11

  2. DrCyanide commented on Sep 15, 2026

    @DrCyanide

    I was getting this same issue on 0.4.2

    #285

  3. DrHepa commented on Sep 24, 2026

    @DrHepa
    SponsorContributor

    Consolidating the v0.4.2 reproductions from #285 and #352 here, since this is the earlier canonical AppImage restart issue.

    I investigated the v0.4.2 source and reproduced the symlink-copy behavior. The release attempted to address the ephemeral AppImage runtime by copying python-embed into userData in ensureStableEmbeddedPython(), but the copy currently uses:

    await cp(getEmbeddedPythonDir(), stableDir, {
      recursive: true,
      preserveTimestamps: true,
    })

    Node's fs.cp() defaults verbatimSymlinks to false. A relative runtime link such as bin/python3 -> python3.11 is therefore copied as an absolute link back into the current /tmp/.mount_Modly-* source. After the AppImage exits, that mount disappears and the supposedly stable runtime plus the venv interpreter chain contain dangling links.

    This explains the shared sequence in #285 and #352:

    1. The first run works while the AppImage mount exists.
    2. After restart, checkSetupNeeded() sees the venv Python as missing and asks for the data directory again.
    3. Extension venvs report venv missing or remain in incomplete/registration-pending quarantine.
    4. Repair can fail while trying to recreate a venv through the broken interpreter chain.

    The original --copies suggestion can provide defense in depth for venv creation, but v0.4.2 also needs the stable runtime copy itself corrected and validated.

    Proposed fix

    await cp(getEmbeddedPythonDir(), stableDir, {
      recursive: true,
      preserveTimestamps: true,
      verbatimSymlinks: true,
    })

    Additionally:

    • Before accepting an existing stable runtime, resolve its Python entry point and require the target to exist inside stableDir; rebuild it if validation fails.
    • Ensure the next release rebuilds affected core and extension venvs once through the corrected interpreter.
    • When recovery setup is required, return the previously saved data base directory instead of always defaulting to Documents/Modly; otherwise users can accidentally redirect an existing installation and make models appear lost.

    Regression coverage

    • Copy a fixture Python tree with relative symlinks from a temporary /tmp/.mount_Modly-*-like directory.
    • Remove the source and verify the copied Python link still resolves inside stableDir and executes.
    • Simulate restart and assert checkSetupNeeded() remains false.
    • Verify the saved models/workspace/extensions/dependencies base path is preserved during recovery.
    • Validate a rebuilt AppImage through install, close, reopen, extension discovery, generation, and Repair.

    The source diagnosis and fs.cp() behavior are reproduced. A rebuilt AppImage E2E remains required before considering the fix complete. The longer analysis was initially posted on #352 before identifying this canonical issue: #352 (comment)

  4. Lorchie commented on Oct 9, 2026

    @Lorchie
    Collaborator

    This is fixed in v0.4.3. The root cause was the copy of the bundled Python runtime out of the AppImage mount: fs.cp turned relative symlinks (bin/python3 -> python3.11) into absolute links pointing back into /tmp/.mount_Modly-*. That mount disappears when the app closes, so every extension venv broke on the next launch. The copy now keeps relative symlinks as they are. Thanks @DrHepa for the diagnosis.

    After updating, your existing extension venvs should work again. If one still fails, a Repair on the Models page rebuilds it. If the problem is still there on v0.4.3, feel free to reopen this issue with your logs.

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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions