If you’ve been exploring AI coding assistants lately, you’ve probably come across DeepSeek — an open-source AI model designed for code understanding, generation, and debugging. While most people use it through the cloud or inside editors like VS Code, you can also run DeepSeek locally on Windows 11 — giving you full privacy, faster responses, and no internet dependency.
In this guide, we’ll walk you through exactly how to set up and run DeepSeek locally on your Windows 11 PC — step by step.
What You’ll Need Before You Start
Before running DeepSeek locally, make sure you have these prerequisites:
- A Windows 11 (64-bit) computer
- At least 8 GB of RAM (16 GB recommended)
- Python 3.10+ installed
- Git installed
- Internet connection (for setup only)
- Optional: A GPU (NVIDIA) with CUDA support for faster inference
Once installed, DeepSeek can run completely offline.
Step 1: Install Python and Git
If you don’t already have Python or Git installed:
Install Python
- Go to https://www.python.org/downloads/windows/.
- Click Download Python 3.12 (or latest version).
- Run the installer and make sure to check:
✅ “Add Python to PATH” - Complete the installation.
Verify it by opening Command Prompt and typing:
python --version
You should see something like:
Python 3.12.1
Install Git
- Download from https://git-scm.com/downloads.
- Run the installer and accept default settings.
- Verify installation:
git --versionYou should see:git version 2.46.0
Step 2: Install Dependencies (PyTorch and Transformers)
DeepSeek uses machine learning libraries like PyTorch and Transformers to run locally.
Install PyTorch
Run this in Command Prompt or PowerShell:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
If you don’t have a GPU, replace the URL with the CPU-only version:
pip install torch torchvision torchaudio
Install Transformers
pip install transformers
These two libraries handle model loading and inference.
Step 3: Clone the DeepSeek Repository
Now you’ll download the DeepSeek model code from GitHub.
In Command Prompt or PowerShell:
git clone https://github.com/deepseek-ai/deepseek-coder.git
Once cloned, navigate to the project folder:
cd deepseek-coder
Step 4: Download the DeepSeek Model
You’ll need to download one of the available DeepSeek models from Hugging Face.
Visit the official model page: https://huggingface.co/deepseek-ai
Choose a model based on your system specs:
| Model | Type | Recommended For |
|---|---|---|
| deepseek-coder-1.3b | Lightweight | Laptops, 8GB RAM |
| deepseek-coder-6.7b | Balanced | Mid-range PCs |
| deepseek-coder-33b | Full | High-end systems with GPU |
Once you’ve picked your model, download it manually or let the Transformers library pull it automatically during runtime.
Step 5: Load and Run DeepSeek Locally
Create a new Python file named run_deepseek.py inside your deepseek-coder folder.
Add the following code:
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load the DeepSeek model
model_name = "deepseek-ai/deepseek-coder-1.3b"
print("Loading model, please wait...")
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
print("Model loaded successfully!")
# Simple interactive prompt
while True:
prompt = input("\nYou: ")
if prompt.lower() in ["exit", "quit"]:
break
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=200)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("\nDeepSeek:", response)
Save and run the script using:
python run_deepseek.py
The model will load (the first time might take a few minutes).
Once loaded, you can chat or generate code directly in your terminal — all offline.
Step 6: Ask DeepSeek to Generate or Explain Code
You can now prompt DeepSeek like this:
You: Write a Python function to check if a number is prime.
It will respond:
def is_prime(n):
if n <= 1:
return False
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True
Or ask:
You: Explain this function line by line.
DeepSeek will provide a detailed explanation — just like an AI code tutor running on your machine.
Step 7: Run DeepSeek With GPU (Optional)
If your PC has an NVIDIA GPU, you can enable GPU acceleration to make DeepSeek much faster.
Modify this section in your Python file:
model = AutoModelForCausalLM.from_pretrained(model_name).to("cuda")
Then verify that your GPU is being used:
nvidia-smi
This will show your GPU’s utilization while DeepSeek runs.
Step 8: Create a Simple Local Web Interface (Optional)
If you’d prefer a friendlier interface instead of using the terminal, you can create a local web UI using Gradio.
Install Gradio:
pip install gradio
Create a new file named app.py:
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "deepseek-ai/deepseek-coder-1.3b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
def deepseek_chat(prompt):
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=200)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
demo = gr.Interface(fn=deepseek_chat, inputs="text", outputs="text", title="DeepSeek Local Chat")
demo.launch()
Run it:
python app.py
Now open your browser and go to:
http://127.0.0.1:7860
You’ll see a local chat interface for DeepSeek — all running locally!
Step 9: Troubleshooting Common Issues
| Problem | Fix |
|---|---|
| CUDA error | Install the correct PyTorch version for your GPU. |
| Out of memory | Try a smaller model (like deepseek-coder-1.3b). |
| Slow startup | The model needs to load into RAM or VRAM — be patient. |
| Tokenizer not found | Check internet connection during the first run; it downloads once. |
| ModuleNotFoundError | Run pip install transformers torch gradio again. |
Once the model downloads, it will run offline from cache — no internet needed afterward.
Wrapping Up
And that’s it! You’ve successfully learned how to run DeepSeek locally on Windows 11. With DeepSeek running on your PC, you now have a private, powerful AI coding assistant that can help you generate, debug, and explain code — all without sending data to the cloud.
Whether you’re coding in Python, JavaScript, or C++, this setup gives you complete control over your workflow.
So fire up your terminal, load DeepSeek, and start building with AI — locally, privately, and on your own terms.