DEV Community

Aaron Jones
Aaron Jones

Posted on

Module Installation Fails Due to Unresolved Dependencies

Problem statement: Custom or third-party modules fail to install or upgrade because required dependencies are missing or not correctly declared in manifest.py, causing import errors and broken functionality.

Step 1 – Read the real error (log/CLI)

When a module fails to install, the real reason is usually in the log:

Option A – From terminal

./odoo-bin -d your_db_name -i your_module_name --log-level=debug
Enter fullscreen mode Exit fullscreen mode

Watch for lines like:

  • Missing required dependency: module_name
  • KeyError: 'module_name'
  • ModuleNotFoundError: No module named 'xyz'
  • External ID not found in the system: module_name.view_id

Those tell you what dependency is missing.


Step 2 – Fix depends in __manifest__.py

Many install failures are because the module uses models from other modules but doesn’t list them as dependencies.

Example of a problematic __manifest__.py

# your_module/__manifest__.py

{
    'name': 'Custom Sales Report',
    'version': '17.0.1.0.0',
    'summary': 'Custom report on sales orders',
    'author': 'You',
    'website': 'https://example.com',
    'category': 'Sales',
    'depends': ['base'],  #  missing 'sale' !!
    'data': [
        'views/sales_report_view.xml',
    ],
    'installable': True,
    'application': False,
}
Enter fullscreen mode Exit fullscreen mode

But inside your Python code or XML, you’re using:

  • Model: sale.order
  • Views from sale module
  • Fields defined in sale module

So Odoo expects sale to be loaded before your module.

Corrected __manifest__.py

# your_module/__manifest__.py

{
    'name': 'Custom Sales Report',
    'version': '17.0.1.0.0',
    'summary': 'Custom report on sales orders',
    'author': 'You',
    'website': 'https://example.com',
    'category': 'Sales',
    'depends': [
        'base',
        'sale',           #  you use sale.order
        'stock',          #  if you use stock.move, etc.
        # add here every Odoo module whose models/views you touch
    ],
    'data': [
        'security/ir.model.access.csv',
        'views/sales_report_view.xml',
        'report/sales_report_templates.xml',
    ],
    'installable': True,
    'application': False,
}
Enter fullscreen mode Exit fullscreen mode

Rule:
Anything you import, inherit, or reference (models/views) → its module must be in depends.

Examples:

  • Using account.move → add 'account'
  • Using hr.employee → add 'hr'
  • Extending mrp.production → add 'mrp'

Step 3 – Ensure the dependency modules actually exist & are visible

Sometimes the dependency is correct but Odoo can’t find the module.

  1. Check your odoo.conf:
[options]
addons_path = /opt/odoo/odoo/addons,/opt/odoo/custom/addons
Enter fullscreen mode Exit fullscreen mode

Make sure:

  • Your custom modules are in /opt/odoo/custom/addons/your_module
  • Any third-party dependency module (e.g., web_responsive, sale_management_extra) is inside one of the paths.
  1. Restart Odoo after changing addons:
sudo service odoo restart
# or
./odoo-bin -d your_db_name
Enter fullscreen mode Exit fullscreen mode
  1. In UI:
  • Go to Apps → Update Apps List (click “Update Apps List”)
  • Then search your dependency module and ensure it’s installable.

If the required module simply doesn’t exist, you must download/install it first.

Step 4 – Handle external Python libraries (non-Odoo deps)

If the error in logs is like:

ModuleNotFoundError: No module named 'pandas'
Enter fullscreen mode Exit fullscreen mode

Then your module depends on an external Python package.

Declare it in __manifest__.py

# your_module/__manifest__.py

{
    'name': 'Data Analysis Integration',
    'version': '17.0.1.0.0',
    'depends': ['base'],
    'external_dependencies': {
        'python': ['pandas', 'requests'],  #  external libs
    },
    'data': [
        'views/data_analysis_view.xml',
    ],
    'installable': True,
}
Enter fullscreen mode Exit fullscreen mode

Install those packages in your environment

pip install pandas requests
# or, if using virtualenv
/path/to/venv/bin/pip install pandas requests
Enter fullscreen mode Exit fullscreen mode

Restart Odoo and try to install again.

Step 5 – Check __init__.py and imports (often looks like dependency issue)

Sometimes the module “fails to install” but the root cause is a broken import in your own code.

Directory structure should look something like:

your_module/
├── __init__.py
├── __manifest__.py
├── models/
│   ├── __init__.py
│   └── sale_report.py
└── views/
    └── sales_report_view.xml
Enter fullscreen mode Exit fullscreen mode

your_module/__init__.py

from . import models
Enter fullscreen mode Exit fullscreen mode

your_module/models/__init__.py

from . import sale_report
Enter fullscreen mode Exit fullscreen mode

your_module/models/sale_report.py

from odoo import api, fields, models


class SaleOrderReport(models.Model):
    _inherit = 'sale.order'   # requires 'sale' in depends

    custom_margin = fields.Float(string="Custom Margin")

    @api.depends('amount_total', 'amount_untaxed')
    def _compute_custom_margin(self):
        for order in self:
            order.custom_margin = order.amount_total - order.amount_untaxed
Enter fullscreen mode Exit fullscreen mode

Common bugs:

  • Typo in file name vs import (from . import slae_report)
  • Importing a model from another module that isn’t in depends
  • Circular import between modules

Step 6 – Clean upgrade/install after fixes

After you change __manifest__.py, __init__.py, or dependencies:

Option A – From UI

  1. Go to Apps
  2. Click Update Apps List
  3. Search your module → click Upgrade (or Install if new)

Option B – From CLI

./odoo-bin -d your_db_name -u your_module_name --log-level=debug
Enter fullscreen mode Exit fullscreen mode

This forces Odoo to:

  • Reload manifest
  • Re-check dependencies
  • Apply Python/XML updates

Quick Checklist for Your Case

When “Module Installation Fails Due to Unresolved Dependencies”:

  1. Check logs → identify exact error (missing module, missing python lib, import error).
  2. Fix depends in __manifest__.py:
  • Add all Odoo modules whose models/views you use.

    1. Ensure dependency modules exist:
  • They’re in addons_path

  • Apps list updated

    1. Handle external libs:
  • Add external_dependencies['python']

  • pip install those packages

    1. Verify __init__.py + imports:
  • Correct module structure and names.

    1. Restart + upgrade module:
  • ./odoo-bin -d db -u your_module_name

Conclusion – Fixing Odoo Module Installation Dependency Issues

When an Odoo module fails to install, it’s rarely “just a bug”—it’s usually a dependency problem hiding in the background. Missing or incorrect entries in manifest.py, unavailable addons, broken imports, or missing Python libraries all lead to the same result: installation failure and confusing error logs.

The good news is: once you follow a disciplined approach, these issues become easy to control:

Always declare every real dependency in depends (every model/view you inherit or reference must have its module listed).

Make sure all required modules are present in addons_path and visible in Apps.

Use external_dependencies for Python libraries and install them in the same environment Odoo runs in.

Keep your module structure (init.py, imports, models/ views) clean and consistent.

After changes, always update the apps list and upgrade the module or use -u your_module_name from CLI.

By treating the manifest file as the source of truth for dependencies and regularly checking logs during installation, you’ll avoid most “Module installation failed” surprises and make your Odoo projects much more stable and predictable.

Top comments (0)