Odoo.sh is a PaaS (Platform as a Service) managed by Odoo SA. Odoo.sh enables you to deploy your own cloud platform. In some cases, we might need to install some external python package in our Odoo.sh environment.
If one of your custom modules requires an external python package, and if it is not installed by default, you can create a requirements.txt file. In this file, you can list the python packages your module depends on.
requirements.txt
xmltodict
Create a file named requirements.txt file inside the root folder of your GitHub repository of the Odoo sh project. You can either create this file from Odoo.sh editor, from the odoo.sh editor creates the file inside the path /src/user/requirements.txt, or you can create the file inside your computer and push the file to the GitHub repository along with the modules.
Now we can use the external python library on our custom module.
Using an external python package on your custom module requires setting the external_dependency on the __manifest__.py file.
'external_dependencies': {
'python': ['xmltodict'],},
Adding a Python dependency requires a module version increase for the odoo.sh platform to install it.
For example,if your module version is currently 0.1 replace it to 0.2
Change,
'version': '0.1',
To
'version': '0.2',
Stage and commit your changes:
> git add requirements.txt
> git add custom_module
> git commit -m "[ADD]requirements.txt"
Then, push your changes.
In the Odoo.sh terminal,
> git push https HEAD:feature-1
In your computer terminal,
> git push
another method to install a python package on sh is from the odoo sh terminal itself. Go to the Odoo.sh shell and type the command for installing the python package.
Sometimes we might need to install a python package to install on our Odoo.sh environment. In that case, we can use these methods to install them.
Have a look at the following blog to explore more about Odoo Install. Odoo Install