Skip to content

Install on Windows ​

This page installs Scholar Lens on a Windows laptop with a small GPU. It suits development and light use; a larger GPU gives better answers (see Local models).

The reference machine is a Lenovo Legion with an RTX 3060 Laptop GPU (6 GB) and 24 GB of memory.

Quick install with Docker ​

If you only want to run Scholar Lens, not develop it, one command does the whole Docker install. Start LM Studio's server with the models loaded first (see Local models), then, from the repository folder:

powershell
.\install.ps1

The installer:

  1. Checks that Docker and Compose 2.24 or newer are running.
  2. Writes .env with new secrets and an admin account with a random password. It keeps an existing .env.
  3. Downloads the reranker model into models/ (about 0.6 GB). -NoReranker skips it.
  4. Turns on SearXNG and the reranker. Docker Desktop has no gVisor, so code cells need the WSL sandbox below.
  5. Sets up podcast voices (-Tts kokoro|chatterbox|none, Kokoro by default) and, only with -Video, the podcast video service (about a 2.7 GB image). Both choices are kept in .env.
  6. Builds the images, starts the stack and waits until every service is healthy.

If PowerShell refuses to run the script, use powershell -ExecutionPolicy Bypass -File .\install.ps1.

Then open http://localhost:5000 and sign in as admin with the ADMIN_PASSWORD from .env. Change it on the Account page. Run .\install.ps1 again after git pull to update; .\install.ps1 -Stop stops the stack and keeps your data.

The rest of this page is the step-by-step install, for development or a custom setup.

The layout ​

  • Windows runs LM Studio, the API and the UI.
  • Docker Desktop runs Postgres and the CPU reranker.
  • A dedicated WSL distro called scholarlens runs Docker Engine with gVisor for the code sandbox. Docker Desktop can't use gVisor, and a separate distro keeps the sandbox's hardening away from your everyday Linux tools.

1. Install the tools ​

  • Docker Desktop.
  • LM Studio.
  • Anaconda (or another Python 3.13), with an environment called learning.
  • Node 24.
  • Git.

2. Choose the small models ​

Six gigabytes of GPU memory fits a 4B chat model and a small embedder:

RoleModelSettings
Chatqwen/qwen3.5-4bcontext 32768, flash attention on, K and V cache q8_0, parallel 2
Embeddingtext-embedding-qwen3-embedding-0.6bcontext 2048, 1024 dimensions
Rerankerbge-reranker-v2-m3 Q8_0on the CPU in Docker

Save the load settings as the model's defaults in LM Studio's GUI. lms load can't set the cache type, and without saved defaults the model comes back at parallel 4 with a full-size cache and spills into shared memory.

A context of 8192 is too small: one draft prompt is about 7,000 to 8,000 tokens before the answer.

On laptops with two GPUs, switch to hybrid mode so Windows draws the desktop on the integrated GPU. This frees about 1.5 GB on the NVIDIA GPU.

Set EMBEDDING_DIMENSIONS=1024 in both .env files. The database must be created with that size. It can't share a database with an installation that uses the 4B embedder (2560).

3. Start the database and the reranker ​

In the repository's root .env, set POSTGRES_PASSWORD, JWT_SECRET and, if another program already holds port 5002, POSTGRES_PORT with a free one.

bash
docker compose -f scholarlens-stack.yml up -d postgres
bash
docker compose -f scholarlens-stack.yml --profile reranker up -d reranker

IMPORTANT

Start Docker Desktop from the Start menu, or let it start when you sign in. A Docker Desktop started from another app's terminal is a child of that app and stops when the app closes or restarts. The API then can't reach Postgres and every sign-in fails.

4. Run the API and UI ​

Copy .env.example to backend/.env. Set DATABASE_URL to the stack's Postgres, port 5002 by default, and the model ids from step 2.

From the backend folder:

bash
pip install -e ".[dev]"
bash
uvicorn app.main:app --port 5020

From the frontend folder:

bash
npm ci
bash
npm run dev

Open http://localhost:5021 and create the admin account.

5. Set up the sandbox in WSL (optional) ​

  1. Create a dedicated distro, for example from the Ubuntu 24.04 image, named scholarlens.

  2. Inside it, install Docker Engine (not Docker Desktop's integration) and gVisor as in Install on Linux.

  3. Clone the repository there and start the sandbox and the relay:

    bash
    docker compose -f scholarlens-stack.yml --profile sandbox --profile sandbox-bridge up -d --build sandbox sandbox-bridge
  4. In the Windows backend/.env, set SANDBOX_URL=http://127.0.0.1:5009 and the same SANDBOX_TOKEN as the distro's .env.

WSL stops an idle distro, which stops the sandbox. Keep it open with a scheduled task that runs at sign-in. In PowerShell:

powershell
$action = New-ScheduledTaskAction -Execute "conhost.exe" -Argument "--headless wsl.exe -d scholarlens --exec sleep infinity"
$trigger = New-ScheduledTaskTrigger -AtLogOn -User $env:USERNAME
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit 0
Register-ScheduledTask -TaskName "ScholarLens sandbox (WSL)" -Action $action -Trigger $trigger -Settings $settings -Description "Keeps the scholarlens WSL distro (code sandbox) running"

For the hardening, turn off automount and interop in the distro's /etc/wsl.conf, and don't enable Docker Desktop's integration for it.

Known quirks ​

  • A broken PyPI download. On some networks pip install fails for mcp with InvalidChunkLength. Download the wheel by its URL from https://pypi.org/pypi/mcp/<version>/json, then install it with pip install --no-index --find-links <folder> mcp.
  • localhost only. Vite listens on IPv6 localhost, so http://127.0.0.1:5021 may not answer. Use http://localhost:5021.
  • A second checkout. Don't run two APIs on the same database: each one runs a job worker.