Install and Run Deepseek Locally in Python in Less Than 5 Minutes
Do you want to run the AI model that broke the stock market on your machine and have 5 minutes to spare?
On January 28 2025 Nvidia, the most valuable publicly traded company in the world (at the time), lost $589bn in value in one day. It was the single biggest drop in the value of a company in one day, ever. The reason for this historic drop? The release of an LLM that required a small fraction of the training power compared with its competitors, implying that maybe Nvidia wont sell as many AI training chips as people thought on January 27.
You can install this groundbreaking LLM, called Deepseek-r1 and interact with it in python, all you need is 1.2GB of free memory! This follows a previous blog of mine found here, but I’ll post it here too for completeness.
Step 1: Install Ollama
Download and Install Ollama for Windows
Head over to Ollama’s GitHub releases and download the installer for Windows.
Follow the installation steps provided.
Install Ollama in Python
Install Anaconda on your machine if you dont have it already. If you already have a way to run python on your machine then skip this step
Open your Anaconda terminal and run:
pip install ollama
Step 2: Pull Deepseek
Once Ollama is installed, download the smallest deepseek-r1 model using the Ollama CLI:
ollama pull deepseek-r1:1.5b
This command fetches the model and makes it ready for use on your local machine. Note there are bigger deepseek models that require more memory to store and power to run. If you have a decent GPU you can probably run deepseek-r1:7b. If you an absolute beast of machine you might even run the deepseek-r1:70b model.
Step 3: Install Jupyter Notebook
For easier experimentation, I set up Jupyter Notebook:
pip install jupyter notebook
To start a notebook, run:
jupyter notebook
This opens a browser interface for writing and testing Python scripts interactively.
Step 4: Chat with the your LLM
Now this LLM has some pretty powerful reasoning capabilities, other folks have already gone into detail about it’s performance. To test it out I passed it a simple question to test its ability to deal with unclear questions, what is the probability of pulling 4 ace of spades from a deck of cards? Run the script below in a jupyter notebook to see how it answered…
import ollama
response = ollama.chat(
model='deepseek-r1:1.5b',
messages=[
{'role': 'user', 'content': ' what is the probability of pulling 4 ace of spades from a deck of cards?'}
]
)
# Print the response
print(response['message']['content'])
If you’re interested on learning more on Deepseek, this Computerphile video on youtube is the best explanation of it I have found. I also recommend checking out Deepseek’s github repo. Too lazy for that? You could always ask an LLM to summarize it for you.
Interested in Multi Agent Systems?
Here I show how to create a multi-agent system, where a Llama LLM and a Deepseek LLM communicate and collaborate to complete a task I set them!