# Introducing odoo-venv

> odoo-venv is a small command-line tool that creates isolated Python virtual environments for Odoo in seconds, with presets for local development, demos, client projects and CI.

**Source:** <https://trobz.com/insights/introducing-odoo-venv/>

---


How do you install and run Odoo? It sounds like a simple question, but you may be surprised by how many valid answers there are, depending on who you ask.

Here is a non-exhaustive overview:

- **Odoo SA**
  - Maintains [DEB and RPM packages](https://nightly.odoo.com)
  - Maintains the official [Odoo Docker Hub image](https://github.com/odoo/docker/tree/master), built on Ubuntu images and its own DEB package
- **OCA (Odoo Community Association)**
  - Provides a Docker image for running tests: [oca-ci](https://github.com/oca/oca-ci)
  - Publishes OCA addons to a pip wheelhouse, which makes a pip-only approach possible
- **Odoo integrators**
  - Use Docker-based solutions, such as:
    - [Doodba](https://github.com/tecnativa/doodba)
    - Camptocamp's [docker-odoo-project](https://github.com/camptocamp/docker-odoo-project)

Each approach has its merits. But the more layers of abstraction a setup relies on, the more complex and challenging local development becomes.

At Trobz, we chose a simple approach based on Python virtual environments: [odoo-venv](https://pypi.org/project/odoo-venv/).

## Why Trobz Runs Odoo in a Virtual Environment

We prefer to run Odoo inside a Python virtual environment. It gives us more control, clarity and flexibility when we:

- Debug issues locally
- Need to know exactly which dependencies are installed
- Switch between Odoo versions or projects

Managing these environments by hand quickly becomes tedious, though, because every project has its own dependency requirements. That is why we built odoo-venv.

## How odoo-venv Works

odoo-venv is a small command-line tool designed to spin up isolated Odoo environments in seconds. It standardizes how we create and manage these environments across our different use cases.

### Key Features

- Creates a Python virtual environment with the correct Python version
- Installs Odoo's core dependencies
- Installs the dependencies declared in addon manifests
- Manages presets for different types of Odoo projects
- Filters out problematic or unwanted dependencies

### It's Fast

One of the biggest advantages of odoo-venv is its speed. Under the hood, it uses [uv](https://docs.astral.sh/uv/), an extremely fast, modern Python package installer. In practice:

- The uv project reports package operations 10–100x faster than with traditional tools such as pip
- You can iterate quickly without waiting for slow pip installs

In short, odoo-venv brings together the simplicity of `python -m venv` and the speed of modern tooling.

## How to Use It

The simplest way to use odoo-venv is with command-line arguments:

```bash
odoo-venv create 17.0 \
    --odoo-dir ~/code/odoo/odoo/17.0 \
    --python-version 3.10 \
    --extra-requirement "debugpy,ipython"
```

This creates a virtual environment for Odoo 17.0 that:

- Uses Python 3.10
- Installs Odoo in editable mode
- Installs Odoo's dependencies
- Adds the extra tools debugpy and ipython

### Using Presets

For configurations you use repeatedly, presets are recommended. odoo-venv ships with four presets, each suited to a specific use case.

#### Local

**What it does**

- Installs the dependencies of all modules, from both `requirements.txt` files and manifests
- Includes development tools such as debugpy, ipython, pylint and coverage
- Skips `gevent` and `greenlet` from Odoo's requirements, as they often cause version conflicts

**Ideal for**

- Exploratory development
- Quick work on OCA modules

#### Demo

**What it does**

- Installs the dependencies of all available modules
- Ensures users can install any module without missing dependencies

**Ideal for**

- Client demonstrations
- UAT environments

#### Project

**What it does**

- Installs the additional dependencies listed in the project
- Keeps the environment minimal and predictable

**Ideal for**

- Production environments
- Client-specific projects

#### CI

**What it does**

- Installs the dependencies of all modules
- Adds extra dependencies for testing, such as websocket-client, coverage and pylint

**Ideal for**

- CI pipelines

You can also create your own preset by defining it in the `presets.toml` file located in `~/.local/share/odoo-venv`.

### Using odoo-venv in Python

odoo-venv can also be used programmatically in Python scripts:

```python
from odoo_venv import create_odoo_venv

create_odoo_venv(
    odoo_version="17.0",
    odoo_dir="~/code/odoo/odoo/17.0",
    venv_dir="./.venv",
    python_version="3.10",
    addons_paths=["~/code/oca/web/17.0"],
    install_addons_dirs_requirements=True,
    extra_requirements=["debugpy", "ipython"],
)
```

## Conclusion

Odoo deployment strategies often feel complex and fragmented. odoo-venv offers a refreshingly simple alternative.

It works best combined with another useful part of our stack: [odoo-addons-path]({{< surl >}}/insights/introducing-odoo-addons-path/).

