how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

How to Set Up Odoo 18 Development Environment Using PyCharm in Ubuntu 22.04

Odoo 18 is the latest iteration of this powerful business management software, widely appreciated for its comprehensive features and its ability to simplify business operations. Using Python 3.10+ for the backend, Odoo 18 uses PostgreSQL as its database system and JavaScript for the frontend interface.

Ubuntu 22.04, a reliable Long-Term Support (LTS) release, provides a stable platform with ongoing updates and security patches for five years. The release also includes periodic updates to the Linux kernel and graphics drivers, ensuring excellent system performance and compatibility.

This guide will walk you through installing Odoo using the PyCharm IDE on Ubuntu 20.04.

Before setting up PyCharm, it’s essential to install a few key libraries and packages necessary for running Odoo. We’ll also cover the installation and configuration of PostgreSQL, setting up Python environments, and managing dependencies.

Let’s explore these initial steps and ensure your system is ready for Odoo development.

Step 1: Download and Install PyCharm IDE

In this step, we will install the PyCharm Community Edition. Before proceeding, make sure your system meets the necessary requirements to ensure the IDE’s smooth operation.

The following are the minimum system requirements for installing PyCharm on your computer:

System Requirements:

Requirement

Minimum

Recommended

RAM

4 GB of available RAM

8 GB of total system RAM

CPU

Any modern processor

Multi-core processor (PyCharm utilises multithreading, so that more cores will improve performance)

Disk Space

3.5 GB of free space

SSD with at least 5 GB of available space

Monitor Resolution

1024×768

1920×1080

Operating System

Officially supported 64-bit versions:

Latest 64-bit versions of Windows, macOS, or Linux (e.g., Debian, Ubuntu, RHEL)

 

– Windows 10 1809 or later

 
 

– Windows Server 2019 or later

 
 

– macOS 11.0 or later

 
 

– Any Linux distribution supporting Gnome, KDE, or Unity DE

 
 

Note: PyCharm is not supported on Linux distributions without GLIBC 2.27 or later, and pre-release versions are not supported.

 

To install PyCharm, you can download the Debian installation file from the following URL:

Downloading PyCharm Community Edition

By using the command line you can install PyCharm. To do so, open the Terminal (press Ctrl + Alt + T to launch it) and execute the following commands:

				
					sudo apt-get update 
sudo apt-get upgrade
sudo snap install pycharm-community --classic

				
			

Step 2: Installing Python 3.12

The latest Python version (3.12) is unavailable in the default Ubuntu repositories. To install this, you’ll need to add an alternative repository. The dead snakes repository on Launchpad provides several Python versions, including 3.12.

  • To add the deadsnakes repository, use the given commands:
				
					sudo add-apt-repository ppa:deadsnakes/ppa 
sudo apt-get update

				
			
  • You can check the updated list of available Python packages by running the following command:
				
					apt list | grep python3.12

				
			
  • To install Python 3.12, run the following command:
				
					sudo apt-get install python3.12
				
			
  •  Use the following command to install packages for Python 3:
				
					sudo apt-get install python3.12-dev build-essential libjpeg-dev libpq-dev libjpeg8-dev libxml2-dev libssl-dev libffi-dev libmysqlclient-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev liblcms2-dev
				
			

Step 3: Install the Web Dependencies

Next, you’ll need to install the essential web dependencies.

				
					sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs/usr/bin/node 
sudo npm install -g less less-plugin-clean-css 
sudo apt-get install -y node-less

				
			

Step 4: Install Wkhtmltopdf

Wkhtmltopdf is required for generating Odoo reports. You can install it by running or using the below mentioned command:

				
					-> sudo wgethttps://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb 
-> sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb 
 

				
			

Step 5: Install PostgreSQL

Now, let’s proceed with installing PostgreSQL:

				
					Sudo apt install postgresql postgresql-client
				
			

Step 6: Configure a Database User Role for Odoo Databases

Follow instructions to create a new database user. As you’ll need this during creating the file for configuration you have to Set the password for this user. Remember to save the password for future reference.

				
					sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo18

				
			

Next, assign superuser privileges to the newly created user.

				
					psql
ALTER USER odoo18 WITH SUPERUSER;

				
			

Finally, exit both the psql session and the Postgres user account.

				
					\q
exit

				
			

Step 7: Obtain Odoo 18 Source Code

You can download the Odoo 18 Community source code directly from Odoo’s GitHub repository or clone it using Git. To begin, first install Git by running the following command:

				
					sudo apt-get install git.
				
			

To use the Odoo code into an ‘odoo18’ directory within your directory, use the following command.

				
					git clone https://www.github.com/odoo/odoo --depth 1 --branch 18.0 --single-branch odoo18

				
			

Step 8: Open the Odoo Project in PyCharm

Open PyCharm Community Edition and navigate to the ‘Odoo18’ directory. When the project opens, you may encounter a dialog box prompting you to create a virtual environment. Please cancel this prompt since we will set up the virtual environment via the terminal.

To open the terminal, click the icon below or use the shortcut Alt+F12.

how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

Next, execute the following commands to create a virtual environment using Python 3.12.

				
					curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
sudo apt install python3.12-venv
python3.12 -m venv your_venv_name

				
			

After off then on the terminal, you’ll see that your virtual environment is now active. The terminal will show an indicator with the name of virtual environment, as shown below:

how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

If your virtual environment doesn’t activate automatically, you can manually activate it using the following command:

				
					source your_venv_name/bin/activate.
				
			

Step 9: Install Required Python Packages

Odoo relies on several Python packages specified in the requirements file in the ‘odoo18’ directory. For the installation of these packages, run the following command in the terminal:

				
					pip install -r requirements.txt
				
			

If no errors appear, you can verify that all dependencies from the requirements.txt file have been installed by running the following command:

				
					pip list
				
			
how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

If you encounter any errors, open the requirements.txt file and install each dependency one by one using the following command:

				
					pip install requirement_name
				
			

In most cases, if packages are listed twice, you only need to install one. If one installation fails, it’s typically not a problem.

Also, if any prerequisites defined with sys_platform as ‘win32’ fail to install, you can safely skip them.

If you encounter errors while the installation of the package “psycopg2==2.9.2; sys_platform != ‘win32’ and python_version <= ‘3.10’ or psycopg2==2.9.5; python_version > ‘3.10’ or sys_platform == ‘win32’,” you can use the given command to install an alternative package instead.

				
					pip install psycopg2-binary
				
			

Step 10: Create the odoo.conf File in the odoo18 Directory

To create the configuration file, right-click the Odoo18 directory, then select New -> File -> odoo.conf.

Once the odoo conf file is created, add the following code block. Be sure to update the db_password field with the password you set for the Odoo database user in the previous step.

				
					[options]
admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo18
db_password = your_password
addons_path = /home/user/odoo18/addons
xmlrpc_port = 8018


				
			

Also, update the addons_path value with the path to the Odoo18 addons directory. To find this path, navigate to the addons directory and press Ctrl + Shift + C to copy the current directory path. Then, paste this path into the addons_path field.

If you create a directory for your custom modules, add its path to the addons_path, separating each path with commas.

Example:

				
					addons_path = /home/user/odoo/addons, /home/user/odoo/custom_addons
				
			

Step 11: Add Python Interpreter

To set up a Python interpreter, go to Settings -> Project: odoo18 -> Python Interpreter.

how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204
how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

When you open the specified window, no further action is required if the interpreter (Python 3.12 from the virtual environment of odoo18) is already configured. If not, select the Add Interpreter option and follow the steps below.

how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

Step 12: Configure the Project in PyCharm

Click Edit Configurations under the Current File option to configure the project settings.

When the dialog box shown or appears, click the “+” button and select “Python” from the list.

Next, fill the fields as shown in the image below.

Name:

You can assign any name to this configuration.

Python Interpreter:

This part should automatically display the project’s Python interpreter, as it was set up in the previous step.

Script-Path:

Select the odoo-bin file located in the directory of odoo18.

Parameters:

Add any necessary parameters here to run the script. The c parameter is required, and you may also need to include the configuration file as a parameter.

Working Directory:

To the project’s current working directory specify the path.

Step 13: Test Run Odoo 18

The Odoo setup is now complete. To test it, click the below button to launch the project.

After this You can now test your setup by going to localhost:8018 in your browser. If all your configurations are correct, the browser will open the Odoo database management page, as shown below.

how-to-set-up-odoo-18-development-environment-using-pycharm-in-ubuntu-2204

Following these steps, you can successfully set up an Odoo 18 development environment using PyCharm on Ubuntu 22.04. This environment allows you to explore the latest features of Odoo, develop custom modules, and manage business processes efficiently.

If you want guidance on installing Odoo 18 on a production server, 

check out the blog: How to Install Odoo 18 on Ubuntu 24.04 LTS Server.

Picture of Adarsh

Adarsh

Hi i'm Adarsh, I'm an Odoo developer passionate about building custom business solutions using the Odoo framework. Through this blog, I share tips, tutorials, and insights from real-world development—whether it’s customizing modules, creating reports, or solving tricky errors.

Get a free quote