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.
-
Open your custom module’s root directory.
-
Create or update the
requirements.txt
file. -
Add the dependency name, for example:
-
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:
-
Open your Odoo.sh project.
-
Click on Shell to access the command line.
-
Run the following command:
-
Then, install the required dependency:
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.