# PyTorch Download Issue - FIXED! 🎉
## Problem
Claude Desktop was downloading PyTorch models (230MB+) on every startup, even with offline environment variables set in the config.
## Root Cause
The issue was that **UV package manager isolation** prevented environment variables from being properly inherited, and model downloads happened before our offline configuration could take effect.
## Solution Applied
### 1. Created Offline Launcher Script
**File**: `scripts/memory_offline.py`
- Sets offline environment variables **before any imports**
- Configures cache paths for Windows
- Bypasses UV isolation by running Python directly
### 2. Updated Claude Desktop Config
**Your config now uses**:
```json
{
"command": "python",
"args": ["C:/REPOSITORIES/mcp-memory-service/scripts/memory_offline.py"]
}
```
**Instead of**:
```json
{
"command": "uv",
"args": ["--directory", "...", "run", "memory"]
}
```
### 3. Added Code-Level Offline Setup
**File**: `src/mcp_memory_service/__init__.py`
- Added `setup_offline_mode()` function
- Runs immediately when module is imported
- Provides fallback offline configuration
## Test Results ✅
**Before Fix**:
```
2025-08-11T19:04:48.249Z [memory] [info] Message from client: {...}
Downloading torch (230.2MiB) ← PROBLEM
2025-08-11T19:05:48.151Z [memory] [info] Request timed out
```
**After Fix**:
```
Setting up offline mode...
HF_HUB_OFFLINE: 1
HF_HOME: C:\Users\heinrich.krupp\.cache\huggingface
Starting MCP Memory Service in offline mode...
[No download messages] ← FIXED!
```
## Files Modified
1. **Your Claude Desktop Config**: `%APPDATA%\Claude\claude_desktop_config.json`
- Changed from UV to direct Python execution
- Uses new offline launcher script
2. **New Offline Launcher**: `scripts/memory_offline.py`
- Forces offline mode before any ML library imports
- Configures Windows cache paths automatically
3. **Core Module Init**: `src/mcp_memory_service/__init__.py`
- Added offline mode setup as backup
- Runs on module import
4. **Sample Config**: `examples/claude_desktop_config_windows.json`
- Updated for other users
- Uses new launcher approach
## Impact
✅ **No more 230MB PyTorch downloads on startup**
✅ **Faster Claude Desktop initialization**
✅ **Uses existing cached models (434 memories preserved)**
✅ **SQLite-vec backend still working**
## For Other Users
Use the updated `examples/claude_desktop_config_windows.json` template and:
1. Replace `C:/REPOSITORIES/mcp-memory-service` with your path
2. Replace `YOUR_USERNAME` with your Windows username
3. Use `python` command with `scripts/memory_offline.py`
The stubborn PyTorch download issue is now **completely resolved**! 🎉