Run AI Models Locally With Ollama and Python @realpython
Run AI Models Locally With Ollama and Python  @realpython
Uploaded September 2026 | Updated December 2026, 2 days ago
Watch the full video course here: realpython.com/courses/get-started-with-ollama

Ollama is an open-source platform that runs modern LLMs directly on your machine — better privacy, no vendor lock-in, and no subscription. In this video, Philipp Acsany and Arianne Dee will show you how to install Ollama, pull a local model, and start talking to it from Python in a few lines of code.

Links mentioned in this video:
How to Get Started With Ollama → realpython.com/courses/get-started-with-ollama
How to Integrate Local LLMs With Ollama and Python → realpython.com/ollama-python
How to Use Ollama to Run Large Language Models Locally → realpython.com/ollama
Ollama Download Page → ollama.com/download
Ollama Model Library → ollama.com/library
Ollama Documentation → docs.ollama.com
ollama on PyPI → pypi.org/project/ollama
ollama-python Source Code → github.com/ollama/ollama-python
Prompt Engineering: A Practical Example → realpython.com/practical-prompt-engineering

Download your free Python Cheat Sheet here: realpython.com/cheatsheet
Free Python Skill Test with instant level + learning plan: realpython.com/skill-test
Want to learn faster? Become a Python Expert with unlimited access to 5,000+ tutorials, videos, and exercises: realpython.com/start

This is a preview of the video course, "How to Get Started With Ollama". Integrating local large language models (LLMs) into your Python projects with Ollama is a great way to improve privacy, reduce costs, and build offline-capable AI-powered apps. Ollama is an open-source platform that makes it straightforward to run modern LLMs locally on your machine. Once you've set up Ollama and pulled the models you want to use, you can connect to them from Python using the ollama library. First, you'll set up Ollama and pull a couple of LLMs. Then, you'll learn how to use chat and text generation from your Python code.

This is a portion of the complete course, which you can find here: realpython.com/courses/get-started-with-ollama
And the original text tutorial is here: realpython.com/ollama-python

The rest of the course covers:

- Getting and Running Ollama
- Downloading Ollama Models
- Installing Python's Ollama Library
- Reviewing Ollama's chat() and generate() Functions
- Calling Ollama's Chat Interface
- Creating a Chat Application
- Exercise: Keep Track of Chat History
- Using Ollama's Text Generation Interface
- Generating Python Code With Ollama
- Exercise: Generate Code With a Single Prompt
- How to Get Started With Ollama (Quiz)


Chapters:
00:00 Why run LLMs on your own machine
01:09 Meet your instructor, Arianne Dee
01:34 Install Ollama and check the version
02:21 Pull llama3.2 from the model library
02:56 Set up a virtual environment
04:48 Install the ollama library for Python
05:38 Call chat() from your Python code
06:38 Send your first message as the user
07:45 Change the answer with a system role
08:46 Where to learn more


🐍 Become a Python expert with real-world tutorials, on-demand courses, interactive quizzes, and 24/7 access to a community of experts at realpython.com

▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
🐍 Start Here → realpython.com/start
🗺️ Guided Learning Paths → realpython.com/learning-paths
🎧 Real Python Podcast → realpython.com/podcast

📚 Python Books → realpython.com/books
📖 Python Reference → realpython.com/ref
🧑‍💻 Quizzes & Exercises → realpython.com/quizzes

🎓 Live Courses: realpython.com/live
⭐️ Reviews & Learner Stories: realpython.com/learner-stories
▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰▰
Run AI Models Locally With Ollama and PythonSemantic Versioning: Django and PythonShould Python Have Kept the GIL? Guido Shares His ViewI Tried Jev AI in Python: Honest First LookGold Plating: The Coding Habit That Wastes Your TimePython Data Classes: Write Less Boilerplate CodeCoding Fundamentals Wont Get You Hired (Do This Instead)Why New Coders Should Install Python From python.orgConfiguring a Versatile LLM Harness & Scraping the Web With Scrapy  | Real Python Podcast #304Upgrade One Dependency or Bump Them All?Good Friction vs Bad FrictionParquet Format: Typed Columns and Compression
Real Python |

Run AI Models Locally With Ollama and Python

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER