rlama fully local RAG

 Absolutely—here is the most complete, step-by-step, real-world “rlama on Windows + Anaconda + Ollama” install guide, blending your full troubleshooting journey (including the Python/conda, virtualenv, and PowerShell/curl/command prompt nuances). This captures all the pain pointsreal fixes, and copy-paste instructions you wish you had on day one.


How to Actually Install rlama and Ollama for Local RAG on Windows

(With Anaconda, Dedicated Virtual Environments, and Troubleshooting)


Intro

This is not a copy-paste from the docs—it’s a real, field-tested installation manual for Windows users running Anaconda, Ollama, and rlama for fully local RAG (Retrieval-Augmented Generation) setups.
You’ll learn both the "just make it work globally" method and the "fully project-isolated" workflow, so you never get stuck on rlama + Python dependency errors again.


1. Download rlama.exe for Windows

Go to the rlama releases page.

Copy the link for the latest rlama_windows_amd64.exe under Assets.

To Download:

  • PowerShell:

    Invoke-WebRequest -Uri "PASTE-YOUR-LINK-HERE" -OutFile "$HOME\Downloads\rlama.exe"
    
  • CMD/curl:

    curl -L -o "%USERPROFILE%\Downloads\rlama.exe" "PASTE-YOUR-LINK-HERE"
    

2. Add rlama.exe to Your PATH (Optional but Recommended)

  • Move the binary to a folder in your PATH (or create one):

    • PowerShell:

      Copy-Item "$HOME\Downloads\rlama.exe" "C:\tools\rlama.exe"
      
    • CMD:

      copy "%USERPROFILE%\Downloads\rlama.exe" C:\tools\rlama.exe
      
  • Add C:\tools to your PATH:

    1. Win+S → "environment variables" → Edit the system environment variables

    2. Click Environment Variables...

    3. Under System variables → Path → Edit... → New → C:\tools

    4. OK out of all dialogs.

  • Open a new terminal:

    rlama --version
    

3. Python + Dependency Setup: Two Approaches


A. Global (base) Anaconda Install (Quick and Works for Most)

If you just want rlama.exe to work from anywhere, do this:

Open Anaconda Prompt (base):

pip install -U FlagEmbedding torch transformers pdfminer.six docx2txt xlsx2csv sentencepiece

If you get errors with sentencepiece, see the troubleshooting section below for Python version/cmake tips!


B. Isolated Project Environment (Recommended for Projects and Clean Installs)

Use this if you want project isolation, the latest wheels, and avoid system pollution.

Step 1: Create Python 3.12 Environment
(Some packages break on 3.13+ as of mid-2025!)

conda create -n ragpy312 python=3.12
conda activate ragpy312

Step 2: Upgrade Essential Build Tools

pip install --upgrade pip setuptools wheel

If you see errors with CMake, you can also:

pip install cmake
# or (preferred, if you use conda-forge):
conda install -c conda-forge cmake

Step 3: Install All Python Dependencies

pip install FlagEmbedding torch transformers pdfminer.six docx2txt xlsx2csv sentencepiece

Step 4: Confirm Everything Works

python --version
python -c "import FlagEmbedding; import sentencepiece; print('All good!')"

You should see "All good!" with no errors.


4. Fixing “Python Was Not Found” and Dependency Errors

  • Check which Python is in your PATH:

    where python
    

    The first result must be your (base) or (ragpy312) python, not WindowsApps.

  • If rlama.exe can’t find Python or dependencies:
    You probably installed them in a conda env, but the Go binary (rlama.exe) doesn’t see that env by default!

Solution 1 (Easiest):

  • Install all deps in (base), and always run rlama.exe from (base).

Solution 2 (Advanced):

  • Temporarily prepend your env to PATH before running rlama.exe:

    set PATH=C:\Users\saad0\anaconda3\envs\ragpy312;C:\Users\saad0\anaconda3\envs\ragpy312\Scripts;%PATH%
    c:\tools\rlama.exe run myrag
    

    This lets rlama.exe “see” your env’s Python.

Solution 3 (For Python Package Only):

  • If you’re running as a module (for dev, not prod):

    conda activate ragpy312
    python -m rlama rag llama3 myrag "C:\Users\saad0\Documents\your_docs_folder"
    python -m rlama run myrag
    

    (Most users should use the .exe for CLI.)


5. Build Issues: sentencepiece/CMake

Problem:

error: subprocess-exited-with-error ... CMake Error ...

Solution:

  • Install cmake:

    pip install cmake
    # or
    conda install -c conda-forge cmake
    
  • Still stuck? Use Python 3.12 (as above). Some wheels won’t build on 3.13+ as of 2025!


6. Pull Ollama Models

Works in CMD or PowerShell:

ollama pull llama3
ollama pull snowflake-arctic-embed2

7. Create and Run Your RAG Store

Assuming rlama.exe is in your PATH:

  • PowerShell:

    rlama rag llama3 myrag "$HOME\Documents\your_docs_folder"
    rlama run myrag
    
  • CMD:

    rlama rag llama3 myrag "%USERPROFILE%\Documents\your_docs_folder"
    rlama run myrag
    

8. Full Troubleshooting Timeline (Real-World Errors and Fixes)

Error 1:

No external extractor found. Text extraction will be limited.
⚠️ Warning: FlagEmbedding library is not installed. Run 'rlama install-dependencies' to install it
  • Fix: Ensure you installed all deps in the (base) env or your project env (see above).

Error 2:

Python was not found; run without arguments to install from the Microsoft Store...
  • Fix:

    • Check where python and your PATH.

    • Prepend your env as in Solution 2 above.

    • If running as .exe, install in (base).

Error 3:

error: subprocess-exited-with-error ... CMake Error ...
  • Fix: Install cmake; downgrade to Python 3.12.

Error 4: “rlama run” gets stuck

  • Fix: Double-check your model is pulled (ollama pull llama3).

  • Ensure dependencies are present (see pip list in your env).


9. Quick Summary Table

TaskAnaconda (base)Virtual Env (ragpy312)
Install deps for .exepip install ... (in base)(rlama.exe ignores these)
Install deps for scripts(doesn't isolate)pip install ... (in env)
Run rlama.exerlama ...rlama ... (needs hack for env)
Run as moduleN/Apython -m rlama ...

10. Pro Tips & Gotchas

  • Always check where python and your PATH order before running rlama.exe.

  • If you see "Python not found," you’re probably not in the right env, or PATH is wrong.

  • For most users, install everything in (base) and use rlama.exe.

  • For advanced scripting or isolation, use a conda env, but remember:
    Go binaries ignore your activated venv unless you "hack" PATH.


Ultimate Copy-Paste for Clean, Isolated Setup

conda create -n ragpy312 python=3.12
conda activate ragpy312
pip install --upgrade pip setuptools wheel
pip install cmake
pip install FlagEmbedding torch transformers pdfminer.six docx2txt xlsx2csv sentencepiece
python -c "import FlagEmbedding; import sentencepiece; print('All good!')"

Now to use this Python for scripts:

python -m rlama rag llama3 myrag "C:\Users\saad0\Documents\your_docs_folder"
python -m rlama run myrag

Or for CLI rlama.exe, see above re: PATH hack!


Last Word

This is the battle-tested, bug-proof, hybrid setup for rlama + Ollama + Python on Windows, with real fixes for every error in the book. Bookmark, share, and save hours.

Great question! In rlama, if you update (change, add, or remove) documents in your RAG folder, you’ll want to re-synchronize your RAG database so it can chunk and re-embed the new/updated files.

Here’s exactly how to do it for each workflow:


A. If You Are Using rlama.exe (CLI Binary)

1. To Add/Sync New or Changed Documents

  • Use the add-docs command:

    rlama add-docs myrag "C:\Users\saad0\Documents\your_docs_folder"
    
    • This adds or updates docs in the myrag RAG store, without wiping everything.

  • To remove docs that were deleted from the folder:
    rlama does not auto-remove missing docs from the index—you must remove them manually with:

    rlama remove-doc myrag "name_of_file_to_remove"
    

    (Repeat for each deleted file if necessary.)

2. To Completely Rebuild the RAG Store

If you want a fresh start (e.g., massive document changes or cleanup):

  • Delete the RAG and recreate:

    rlama delete myrag
    rlama rag llama3 myrag "C:\Users\saad0\Documents\your_docs_folder"
    
    • This is a "hard reset"—all previous chunks and embeddings are erased, new ones are built from scratch.


B. If You Are Using the Python Module

In your active Python/conda env:

python -m rlama add-docs myrag "C:\Users\saad0\Documents\your_docs_folder"
# or
python -m rlama remove-doc myrag "name_of_file_to_remove"

Or recreate the RAG as above if you want a clean slate.


C. How to Confirm It Worked

  • List docs in the RAG:

    rlama list-docs myrag
    

    (See what’s currently indexed.)

  • List all chunks:

    rlama list-chunks myrag
    

Typical Update Flow for Most Users

  1. Edit/add/remove docs in your RAG folder.

  2. Run:

    rlama add-docs myrag "C:\Users\saad0\Documents\your_docs_folder"
    
  3. Optionally clean up removed docs with remove-doc if you deleted files.

  4. Run your queries as usual:

    rlama run myrag
    

Short version for your blog:

To resync after updating documents:
Run rlama add-docs myrag "your_docs_folder" to update the knowledge base with all new/changed docs. If you removed files, use rlama remove-doc for each deleted doc, or delete/recreate the RAG for a full rebuild.


Added new text file to the todo folder, and ran:

(ragpy312) C:\Users\saad0\Documents\_RAG_DOCS>rlama add-docs todo ./todo

No external extractor found. Text extraction will be limited.

No external extractor found. Text extraction will be limited.

Found 3 supported files, 0 unsupported files, and 0 excluded files.

Checking Python text extraction tools...

Installing pdfminer.six...

Installing pdfminer.six...

Requirement already satisfied: pdfminer.six in c:\users\saad0\.rlama\venv\lib\site-packages (20250506)

Requirement already satisfied: charset-normalizer>=2.0.0 in c:\users\saad0\.rlama\venv\lib\site-packages (from pdfminer.six) (3.4.2)

Requirement already satisfied: cryptography>=36.0.0 in c:\users\saad0\.rlama\venv\lib\site-packages (from pdfminer.six) (45.0.5)

Requirement already satisfied: cffi>=1.14 in c:\users\saad0\.rlama\venv\lib\site-packages (from cryptography>=36.0.0->pdfminer.six) (1.17.1)

Requirement already satisfied: pycparser in c:\users\saad0\.rlama\venv\lib\site-packages (from cffi>=1.14->cryptography>=36.0.0->pdfminer.six) (2.22)


[notice] A new release of pip is available: 25.1.1 -> 25.2

[notice] To update, run: C:\Users\saad0\.rlama\venv\Scripts\python.exe -m pip install --upgrade pip

✅ pdfminer.six installed successfully!

Warning: no text extracted from C:\Users\saad0\Documents\_RAG_DOCS\todo\2025-07-29 Notes to self.txt

Document added: 2025-08-01 saad's todo - google doc.txt (3831 characters)

Document added: new 2.txt (90 characters)

Successfully loaded 2 new documents. Chunking documents...

Skipped 1 documents that were already in the RAG.

Generated 1 chunks from 1 new documents. Generating embeddings...

Generating embeddings: 1/1 chunks processed (100%)

Successfully generated embeddings for 1 chunks using 3 parallel workers

Successfully added 1 new documents (1 chunks) to RAG 'todo'.

Documents from './todo' added to RAG 'todo' successfully.


Next I ran:

(ragpy312) C:\Users\saad0\Documents\_RAG_DOCS>c:\tools\rlama.exe run todo


Still getting extractor problem, tried to run:

(base) C:\Users\saad0\Documents\_RAG_DOCS>conda install -c conda-forge sentencepiece


Success, next:


pip install --upgrade FlagEmbedding torch transformers pdfminer.six docx2txt xlsx2csv


Ouch, an error: ERROR: Failed to build installable wheels for some pyproject.toml based projects (zlib-state)
error: Microsoft Visual C++ 14.0 or greater is required.

Looking into it, and it looks like it's not critical!

python -c "import sentencepiece, FlagEmbedding, pdfminer, docx2txt, xlsx2csv; print('All good!')"

All good!


rlama list-docs todo
rlama run todo


Comments

Popular posts from this blog

Feature: Audit log for one login, and identity service

Getting started - Build your data science lab environment

QA - Run #1 - Results