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.ps1The installer:
- Checks that Docker and Compose 2.24 or newer are running.
- Writes
.envwith new secrets and anadminaccount with a random password. It keeps an existing.env. - Downloads the reranker model into
models/(about 0.6 GB).-NoRerankerskips it. - Turns on SearXNG and the reranker. Docker Desktop has no gVisor, so code cells need the WSL sandbox below.
- 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. - 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
scholarlensruns 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:
| Role | Model | Settings |
|---|---|---|
| Chat | qwen/qwen3.5-4b | context 32768, flash attention on, K and V cache q8_0, parallel 2 |
| Embedding | text-embedding-qwen3-embedding-0.6b | context 2048, 1024 dimensions |
| Reranker | bge-reranker-v2-m3 Q8_0 | on 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 postgresbash
docker compose -f scholarlens-stack.yml --profile reranker up -d rerankerIMPORTANT
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 5020From the frontend folder:
bash
npm cibash
npm run devOpen http://localhost:5021 and create the admin account.
5. Set up the sandbox in WSL (optional)
Create a dedicated distro, for example from the Ubuntu 24.04 image, named
scholarlens.Inside it, install Docker Engine (not Docker Desktop's integration) and gVisor as in Install on Linux.
Clone the repository there and start the sandbox and the relay:
bashdocker compose -f scholarlens-stack.yml --profile sandbox --profile sandbox-bridge up -d --build sandbox sandbox-bridgeIn the Windows
backend/.env, setSANDBOX_URL=http://127.0.0.1:5009and the sameSANDBOX_TOKENas 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 installfails formcpwithInvalidChunkLength. Download the wheel by its URL fromhttps://pypi.org/pypi/mcp/<version>/json, then install it withpip install --no-index --find-links <folder> mcp. localhostonly. Vite listens on IPv6localhost, sohttp://127.0.0.1:5021may not answer. Usehttp://localhost:5021.- A second checkout. Don't run two APIs on the same database: each one runs a job worker.