{"title":"Port a Pinokio app to Linux without a Linux machine","description":"For Pinokio launcher authors on Windows or macOS with no Linux PC. Finds what breaks on Linux (venv paths, case-sensitive files, shell syntax, torch/CUDA wheels, Mac- or Windows-only device code, native builds, Linux VRAM and RAM limits) and fixes it behind platform checks, so Windows and Mac behave as before. Then verifies without Linux hardware: uv resolution for Linux, GitHub Actions on Ubuntu, WSL2, a VM, a rented GPU, or a precise Linux tester checklist.","instructions":"Make this Pinokio launcher install and run on Linux, without changing how it behaves on Windows and macOS:\n\n**{{app}}**\n\nI develop on **{{author_os}}** and don't have a Linux machine. Find the Linux problems by reading the code, and check your fixes with the methods under \"Then, check it without a Linux machine\".\n\nA Linux user's report, if I have one. Treat it as evidence, not as the full list of problems:\n\n{{linux_report}}\n\n**First, understand the launcher.**\n\n- Read every launcher file (`install.js`, `start.js`, `update.js`, `reset.js`, `torch.js`, `pinokio.js`, `pinokio.json`), the app's requirements and setup files, and every Python file that picks a device, builds a path or calls a program.\n- Follow the [official Pinokio documentation](https://desktop.pinokio.co/docs/) and existing launcher conventions. Use Pinokio's built-in APIs (`shell.run` with `env`, `venv` and `path`; `fs.copy`; `fs.link`; `hf.download`; `script.start`; and the `platform`, `gpu`, `exists`, `which` and `port` helpers) rather than OS-specific shell tricks.\n- Before changing anything, tell me in plain words what the launcher does on each OS.\n\n**Then, find what breaks on Linux.**\n\nGo through every item below. For each one, name the file and line, or say \"not affected\".\n\n*Paths and file names*\n- **Venv layout:** Windows uses `env/Lib/site-packages` and `env/Scripts`. Linux and macOS use `env/lib/pythonX.Y/site-packages` and `env/bin`. Hard-coded venv paths need a branch per platform. A real case: an Open WebUI launcher's `fs.copy` from `env/Lib/site-packages/...` only worked on Windows. Where you can, ask Python for the path instead.\n- **Case sensitivity:** Linux file systems are case-sensitive, while Windows and macOS (by default) are not. `import Utils` against `utils.py`, `Model.safetensors` against `model.safetensors`, and `./Assets` against `./assets` all work for me and fail on Linux. Compare every referenced name with the real file name.\n- **Separators and quoting:** look for backslashes, drive letters and string-joined paths. Paths with spaces break shell strings (a lip-sync launcher's ffmpeg calls failed on file names with spaces). Pass argument lists to `subprocess`, or quote every path.\n- **Line endings and exec bits:** a CRLF `.sh` fails with `/bin/bash^M: bad interpreter`. Add `*.sh text eol=lf` to `.gitattributes`. Files committed from Windows lose the executable bit, so call them with `bash script.sh`.\n- **/tmp can be RAM:** on many Linux desktops `/tmp` is a tmpfs held in RAM. Never put venvs, models or large temporary files there. Point `TMPDIR` into the app folder if the app writes big temporary files.\n\n*Shell and environment variables*\n- Pinokio uses `cmd.exe` on Windows and bash on Linux and macOS. Syntax like `set X=1&& cmd`, `%VAR%`, `copy`, `del` and `.bat` files is Windows-only. Use `shell.run`'s `env` object. Where a command must differ, give one command per platform with a conditional on `platform`.\n- If a variable set in `env` does not reach the app on Linux (seen with `HOST`, a name some Unix shells set themselves), set it inline for Linux and macOS (`HOST=127.0.0.1 python app.py`) and keep the Windows form.\n- Check that variable names match exactly what the app reads. A SillyTavern launcher set `SILLY_TAVERN_PORT` while the app reads `SILLYTAVERN_PORT`.\n- Keep the URL pattern in `start.js` tight: `/(http:\\/\\/[0-9.:]+)/`. A loose `http://\\S+` captured stray characters, and the Web UI link broke.\n- Pinokio shells cannot use `sudo`, so never write `apt install`. Get system tools from Pinokio's conda (for example `conda install -c conda-forge ffmpeg`) or from pip wheels.\n\n*PyTorch, CUDA and device code (the most common breakage)*\n- **Torch builds:** on Linux, PyPI's `torch` is already a CUDA build and pulls in Triton itself. On Windows, PyPI's torch is CPU-only, which is why Windows launchers add `--extra-index-url https://download.pytorch.org/whl/cu1XX`. Make sure Linux gets a CUDA build too, not a CPU-only one by accident.\n- **Windows-only packages:** never install `triton-windows`, `win_amd64` wheel URLs, `pywin32` and similar packages on Linux. Put them behind a `win32` condition, and give Linux the matching `manylinux` wheel or the PyPI package.\n- **Prebuilt wheel links:** for flash-attn, SageAttention, xformers, spconv, nvdiffrast and similar packages, the release `.whl` is built for one OS, Python, torch and CUDA version. Find the `linux_x86_64` / `manylinux` asset of the same build. If none exists, use the PyPI wheel, a source build, or an optional fallback that skips the package.\n- **Choosing the torch build:** Pinokio's stock `torch.js` may pin an older torch than the app needs. If so, pick the build from `gpu` and from `nvidia-smi --query-gpu=driver_version,compute_cap --format=csv,noheader`:\n  - cu130 needs driver ≥ 580 and dropped Maxwell, Pascal and Volta.\n  - cu128 needs driver ≥ 570.\n  - cu126 still covers sm_50 to sm_90.\n  - Blackwell (RTX 50xx, sm_120) needs cu128 or newer, and a Triton version that knows sm_120.\n  - AMD has official PyTorch ROCm wheels only on Linux, so offer it there.\n- **Device selection:** search for `mps`, `cuda`, `torch.device`, `os.name == 'nt'`, `sys.platform` and `platform.system()`. `\"mps\" if mps available else \"cpu\"` silently runs on the CPU on a Linux NVIDIA PC. Use CUDA, then MPS, then CPU. An `if win32 … else <Mac code>` branch sends Linux down the Mac path.\n- **Mixed CUDA versions:** faster-whisper/CTranslate2 needs CUDA 12 cuBLAS (`libcublas.so.12`), which a CUDA 13 torch does not ship, so GPU Whisper falls back to the CPU. Install `nvidia-cublas-cu12` and load its `.so` by path (`ctypes.CDLL`) before the import.\n- **Linux-only gains:** `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` works on Linux, but not on Windows. `torch.compile` and Triton work out of the box on Linux. If they were turned off because of Windows, consider turning them on for Linux, with a fallback.\n\n*Native builds inside Pinokio on Linux (prefer wheels)*\n- Pinokio's conda CUDA keeps its headers in `$CUDA_HOME/targets/x86_64-linux/include`. Add that folder to `CPATH`. Do not repoint `CUDA_HOME`: nvcc then exits with 255.\n- Pinokio exports a very wide `TORCH_CUDA_ARCH_LIST` and `CUDAARCHS`. Set them to empty for the build so the project detects the real GPU.\n- A system PyTorch can put `/usr/lib/cmake/Torch` first. Set `CMAKE_PREFIX_PATH` to the venv's `torch.utils.cmake_prefix_path`.\n- Linux needs `gcc`/`g++`, not MSVC. Pinokio's conda can provide `gxx` from conda-forge.\n\n*Linux desktop behaviour*\n- **VRAM is shared with the compositor:** filling the GPU to the last MB can break window switching, video players and screenshots, sometimes until the user logs out. Keep a few GB in reserve by default, and make \"use everything\" a manual option.\n- **systemd-oomd** can kill the whole session when swap fills. Huge pinned-RAM loads, or a second copy of the model, can log the user out. Check free memory first, and refuse to start a second copy.\n- `pgrep -f` / `pkill -f` match their own shell. Use a bracket pattern (`[s]erve.py`).\n- If Linux truly cannot be supported, declare that in `pinokio.json` (`platform`, `arch`, `gpu`) rather than letting the install fail halfway.\n\n**Then, fix it.**\n\n- Put Linux-only changes behind a `platform === 'linux'` condition, or make a change that is correct on all three OSes. Never swap a working Windows or macOS command for a Linux one.\n- Make one logical fix per change, each with a short comment explaining why Linux needs it, so I can review fixes for an OS I can't run.\n- End `install.js` with a small check that prints the platform, Python, torch, CUDA and the device the app will use, and that fails with a clear message if torch can't import. Then one Linux log answers most questions.\n- Keep everything minimal. Avoid unnecessary code, abstractions, and changes to the original project.\n\n**Then, check it without a Linux machine.**\n\nDo as many of these checks as the changes need, and report the result of each:\n\n1. **Resolve Linux dependencies from my OS:** run `uv pip compile requirements.txt --python-platform x86_64-manylinux_2_28 --python-version 3.X`, with the same index flags the launcher uses. If it resolves, every wheel exists for Linux. If it fails, you have found the package that breaks the Linux install.\n2. **GitHub Actions:** add a workflow with an `ubuntu-latest`, `windows-latest` and `macos-latest` matrix. It runs the launcher's install commands, imports the app, and does a tiny CPU-only run with a time limit. The runners have no GPU. That is enough to prove paths, case, imports and installation.\n3. **On Windows, WSL2:** it runs a real Linux kernel with the NVIDIA GPU, so you can run the commands by hand, CUDA included. It is not a real Linux desktop, so label those results \"WSL2\".\n4. **On macOS, a Linux VM or container** (Docker, OrbStack, UTM, Lima) for CPU-only checks of installation, paths and imports.\n5. **For CUDA builds, attention kernels or VRAM behaviour:** suggest renting a Linux cloud GPU for an hour and running the install there.\n6. **A message for Linux testers:** what to run, and what to send back. That is the full Pinokio terminal logs of install and start, `nvidia-smi`, the distribution and desktop, and `df -h /tmp`.\n\nLabel every result **Verified** (ran on Linux), **Resolved** (dependency resolution or CI passed) or **Untested**. Never call something \"tested on Linux\" unless it ran on Linux. Clearly explain anything you couldn't fix or verify.\n\n**Finally, offer to publish it.**\n\nOnce the fixes are done, ask me if I'd like to publish them.\n\nIf I say yes:\n\n- Add a \"Platform support\" table to the README: Windows, macOS, Linux NVIDIA, Linux AMD and Linux CPU, each marked Verified, Resolved, WSL2 or Untested, with the date.\n- Show me the full list of changes and commits, and confirm with me before pushing. If the launcher isn't mine, offer to open a pull request to its repository instead.\n- If the README has no install badge, add this one near the top, replacing OWNER/REPO with the actual repository:\n  `[![Install with Pinokio](https://badges.pinokio.co/install.svg)](https://pinokio.co/resolve?url=https://github.com/OWNER/REPO)`\n- Give me the repository or pull request URL, and the message for Linux testers.\n\nDon't publish anything without my explicit approval.","intent":"create_app","fields":[{"name":"app","type":"text","required":true,"label":"Which Pinokio launcher should be made to work on Linux? (Git repo URL or local folder)","help":"","defaultValue":""},{"name":"author_os","type":"choice","required":true,"label":"Which OS does the launcher's author develop and test on?","help":"","defaultValue":"","choices":["Windows","macOS","Windows and macOS"]},{"name":"linux_report","type":"multiline","required":false,"label":"Paste a Linux user's error log or bug report, if you have one.","help":"","defaultValue":""}],"id":"01m8n1dxpr3ntg2rzcyxgzkh7g","coverUrl":"https://api.pinokio.co/template-covers/01m8n1dxpr3ntg2rzcyxgzkh7g/8163e4ee-5ff7-4ee8-a8b0-615cfcfe44ff.webp","publishedAt":"2026-11-30T01:37:21.325Z","unlistedAt":"2026-11-30T01:34:37.784Z","updatedAt":"2026-11-30T01:34:39.235Z","author":{"username":"thomas_eric","name":"Thomas Eric 🇧🇷 @ 🐧CachyOS  Linux🐧","avatarUrl":"https://assets.pinokio.co/avatars/optimized/1786703965845-zudhbqvvgof.webp"},"substitutionRules":"Replace every original {{name}} occurrence in one pass. Whitespace around names is allowed. An odd backslash before {{...}} escapes a literal token; each preceding backslash pair emits one backslash. Other backslashes are unchanged. Never expand inserted answers or interpret replacement-string syntax. Defaults initialize answers; optional blanks are empty strings."}