Introduction
Odoo 18 is an open-source ERP and business management software that helps you to streamline your business processes. To ensure compatibility and performance, you need to use the right Python version when installing and running Odoo 18. This version of Odoo requires Python 3.10 or above to install and run smoothly. Also, Python pip must be installed to manage Odoo Python libraries.
Before you start the Odoo 18 installation, make sure you have completed all the prerequisites to avoid any issues during setup.
System Requirements
Odoo 18 (both Community and Enterprise) requires Python 3.10 or above. Python 3.7, 3.8 or 3.9 are not supported as Odoo 18 uses new features and performance improvements introduced in Python 3.10 and above.
If you are using Python 3.13, be aware that some packages (e.g. Babel 2.16.0, greenlet 3.1.1, Pillow 10.4.0) need to be updated as cgi module is deprecated in Python 3.13 which may affect Odoo functionality.
Database Server Setup
To run Odoo 18 efficiently, you need a robust database management system. PostgreSQL is the recommended choice for Odoo due to its reliability and ability to handle complex data operations. Begin by installing PostgreSQL on your server using the following command:
sudo apt-get install postgresql-14
Once installed, start the PostgreSQL database server:
sudo systemctl start postgresql
To ensure PostgreSQL runs automatically after a reboot, enable the service:
sudo systemctl enable postgresql\
Next, create a new PostgreSQL user dedicated to Odoo. This user will manage all database operations for your Odoo 18 instance. Execute the following command:
sudo -u postgres createuser -s odoo18
Set a secure password for the new odoo user to protect your database server. With PostgreSQL set up as your database management system, Odoo 18 will have a reliable backend for storing and managing business data.
Installing Python Version for Odoo 18
Windows
- Download the latest Python 3.10 or higher version from the official Python website.
- During installation, ensure you check the box “Add Python to PATH” and include pip in the setup.
- Verify the installation by running the command:
python --version
Ubuntu/Linux
- Update your system packages:
sudo apt update && sudo apt upgrade
Before installing Odoo 18, it is essential to update the Ubuntu packages and upgrade them to newer versions.
- Log in to your Ubuntu server via SSH to begin the installation process.
- Install Python 3.10 and related packages:
sudo apt install python3.10 python3.10-venv python3.10-dev
- Install pip:
sudo apt install python3-pip
- Verify the installations:
python3 --version pip3 --version
MacOS
- Use Homebrew to install Python 3.10:
brew install [email protected]
- Verify the installation:
python3 --version
- Ensure pip is available:
python3 -m ensurepip --upgrade
Required Python Packages
Odoo 18 relies on a set of specific Python packages to function correctly. To keep your environment clean and avoid conflicts, it’s best to use a Python virtual environment. Start by creating a new virtual environment for Odoo 18:
python3 -m venv odoo18-venv
Activate the virtual environment with:
source odoo18-venv/bin/activate
Before installing the required Python packages, make sure pip and setuptools are up to date:
pip install --upgrade pip setuptools
Now, install all necessary Python packages for Odoo 18 using the requirements file provided in the Odoo source directory:
pip install -r requirements.txt
This step ensures that all Python dependencies are correctly installed in your virtual environment, providing a stable foundation for running Odoo 18.
Setting Up a Virtual Environment
To avoid conflicts with system wide python packages, it’s recommended to use a virtual environment for Odoo 18. Odoo also requires PostgreSQL as its database management system to store and manage data. It’s also recommended to create a dedicated Odoo system user (user account) for Odoo to enhance security.
Creating a dedicated Odoo system user with its own home directory is important to organize Odoo files and to have a secure environment. This user account should not be the root user, running Odoo as root is a security risk. Instead assign sudo privileges to the Odoo system user for administrative tasks but never run services as root. You can switch to the Odoo system user by sudo su – odoo18 (replace ‘odoo18’ with your chosen username). For consistency and easier management it’s recommended to use the same name for the system user and the PostgreSQL database user (e.g. odoo18).
After creating the user account you should configure PostgreSQL to work with Odoo, including creating the database user and permissions. Download the Odoo files into the home directory of the Odoo system user and create an addons directory in the Odoo installation path to store custom modules. When configuring Odoo make sure to create and edit the Odoo conf file to set parameters like admin password and database connection details. When running Odoo specify the script path to the odoo-bin file to start the Odoo server.
Steps:
- Create a virtual environment:
python3 -m venv odoo18-venv
- Activate the virtual environment:
Windows:
odoo18-venv\Scripts\activate
Linux/MacOS:
source odoo18-venv/bin/activate
- Install Odoo dependencies:
pip install -r /path/to/odoo18/requirements.txt
- After installation, create a configuration file for Odoo to define essential settings like database connection details and admin password.
The requirements.txt file in the Odoo 18 source directory specifies package versions compatible with Python 3.10 and above, such as Babel 2.10.3 for Python >=3.11 and greenlet 3.0.3 for Python >=3.12. Odoo 18 can be installed on Ubuntu 24.04, 20.04, and 22.04. Once installed, Odoo 18 can be accessed in a web browser at port 8069.
Configuration File Setup
A proper configuration file is essential for Odoo 18 to connect to the database and manage its modules. Begin by creating a configuration file named “` odoo.conf in the “` /etc/odoo directory:
sudo nano /etc/odoo/odoo.conf
In this configuration file, specify key settings such as the database host, port, database user, password, and the paths to your addons directories. For example:
[options]
db_host = False
db_port = False
db_user = odoo18
db_password = your_secure_password
addons_path = /opt/odoo18/addons
After saving your changes, set the correct permissions so that only the Odoo user can read and modify the configuration file. This helps protect sensitive information and ensures Odoo 18 can access its required settings securely.
Setting up the Database
With PostgreSQL and your Odoo user in place, the next step is to create a new database for Odoo 18. Use the following command to create a new database:
sudo -u postgres createdb odoo18
Grant all necessary privileges to the Odoo user so it can perform database operations:
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE odoo18 TO odoo18;"
Make sure the database is configured with the correct encoding (typically UTF-8) and locale settings to support Odoo’s features. This setup ensures your Odoo 18 instance has a dedicated, fully-permissioned database user and database, ready for business operations.
Verifying Compatibility
Before proceeding with Odoo 18 installation, verify your Python version:
- Run:
python3 --version
to confirm it is 3.10 or higher.
- If using Python 3.12 or 3.13, ensure you have updated packages like lxml to version 4.9.3 for Python 3.12.
- Be cautious with Python 3.13, as deprecated modules such as cgi may require code modifications in Odoo’s http.py file to maintain compatibility.
Securing the Server
Securing your Odoo 18 server is vital to protect your business data from unauthorized access and cyber threats. Start by installing Fail2Ban, which helps defend against brute-force attacks:
sudo apt-get install fail2ban
Configure Fail2Ban to monitor Odoo login attempts and automatically block suspicious IP addresses. Additionally, set up a firewall to restrict access to only the necessary ports, such as HTTP/HTTPS and the Odoo service port.
Regularly update your Ubuntu server and Odoo installation to apply the latest security patches and fixes. Consider utilizing Odoo support and maintenance services to ensure your system is always up-to-date and secure. By following these steps, you can significantly enhance the security of your Odoo 18 deployment and safeguard your business processes.
Best Practices for Developers
- Use code editors like PyCharm, VSCode or VSCodium with Python 3.10+ as the interpreter for Odoo development . If you choose PyCharm, download PyCharm Community Edition from the JetBrains website and make sure to set the correct Python interpreter for your Odoo virtual environment.
- Install linters like PEP8 to keep your Python coding standards, except for Odoo specific exceptions mentioned in Odoo’s coding guidelines.
- Follow Odoo’s Python coding conventions by using filtered, mapped and sorted for readability and avoid custom generators or decorators that will make the code harder to maintain.
- When you create a run configuration in PyCharm, set the script path to the odoo-bin file location so the server starts correctly.
Troubleshooting Common Issues
- Outdated Python Version: Odoo will display errors like “Outdated python version detected, Odoo requires Python >= 3.10.” Upgrade Python and reinstall dependencies..
- Dependency Errors: If pip install -r requirements.txt fails, install packages individually (e.g., pip install psycopg2). Skip Windows-specific packages on non-Windows systems.
- Virtual Environment Issues: Ensure the virtual environment is activated before running Odoo (odoo-bin).
- Python 3.13 Issues: Update requirements.txt with compatible package versions and patch deprecated modules as needed.
- Error Messages During Installation or Runtime: If you encounter errors during installation or while running Odoo, check the Odoo log file for detailed error messages. The log file can provide specific information about what went wrong.
- Diagnosing Issues: Reviewing log files can help diagnose problems related to dependencies, permissions, or server configuration. Log files are essential for monitoring and troubleshooting server security and performance issues.
Conclusion
You need Python 3.10 or later to install and run Odoo 18 smoothly and to have access to the latest Python features that will improve performance. For installation instructions refer to the official Odoo 18 documentation and test your setup thoroughly.
You can install Odoo 18 from the Odoo GitHub repository. If you are planning to migrate or upgrade from Odoo 16 to Odoo 18 follow a step by step guide to avoid common mistakes. After installation you can access Odoo in a browser by the server’s IP and port 8069. This guide will help you to install and configure Odoo 18 on Ubuntu, so you can install Odoo 18 on Ubuntu systems. Leave a comment below to feedback or questions.