How to Install External Dependencies on Odoo.sh

If you’re using Odoo.sh, you may need to install external Python dependencies for your custom modules. Here’s how you can do it easily.

Method 1: Using requirements.txt

The recommended way to install dependencies on Odoo.sh is by adding them to the requirements.txt file located in the root of your module.

  1. Open your custom module’s root directory.

  2. Create or update the requirements.txt file.

  3. Add the dependency name, for example:

    txt
    openupgradelib
  4. Push your changes to your repository. Odoo.sh will automatically install the listed dependencies during deployment.

Method 2: Installing Dependencies via Odoo.sh Shell

If you need to install a dependency manually, you can do it through the Odoo.sh Shell:

  1. Open your Odoo.sh project.

  2. Click on Shell to access the command line.

  3. Run the following command:

    sh
    odoo-bin shell
  4. Then, install the required dependency:

    sh
    pip install openupgradelib # Replace with the actual dependency name

This method is useful for testing but doesn’t persist after a redeployment. To make the installation permanent, always update requirements.txt.

Final Tips

  • Always check dependency compatibility with your Odoo version.
  • Use pip freeze > requirements.txt to generate a list of installed dependencies.
  • For persistent installations, rely on requirements.txt instead of manual installation.