Skip to Content
Menu
This question has been flagged
1 Reply
6348 Views
Good morning,

I am trying to install Odoo 14 on a Centos7 server, but I get the error:


● odoo14.service - Odoo14

Loaded: loaded (/etc/systemd/system/odoo14.service; enabled; vendor preset: disabled)

Active: failed (Result: exit-code) since Thu 2022-04-07 12:24:44 CEST; 11s ago

Main PID: 63993 (code=exited, status=1/FAILURE)



Apr 07 12:24:43 systemd[1]: Started Odoo14.

Apr 07 12:24:44 odoo14[63993]: Traceback (most recent call last):

Apr 07 12:24:44 odoo14[63993]: File "/opt/odoo/odoo14/odoo-bin", line 5, in

Apr 07 12:24:44 odoo14[63993]: import odoo

Apr 07 12:24:44 odoo14[63993]: File "/opt/odoo/odoo14/odoo/__init__.py", line 75, in

Apr 07 12:24:44 odoo14[63993]: import PyPDF2

Apr 07 12:24:44 odoo14[63993]: ModuleNotFoundError: No module named 'PyPDF2'

Apr 07 12:24:44 systemd[1]: odoo14.service: main process exited, code=exited, status=1/FAILURE

Apr 07 12:24:44 systemd[1]: Unit odoo14.service entered failed state.

Apr 07 12:24:44 systemd[1]: odoo14.service failed.


I have tried to access the virtual environment and install the PyPDF2 module with pip install PyPDF2 and pip3 install PyPDF2,
but I get Requirement already satisfied: PyPDF2 in ./odoo14-venv/lib/python3.6/site-packages.

Does anyone know how to fix it?

Avatar
Discard
Best Answer

I think your Odoo service start using system Python executable not the Python virtual environment and PyPDF2 is not installed in System python.

Solution, Configure Odoo in a Python virtual environment and modify systemd init script to use virtual environment Python to start Odoo. 

Example line in etc/systemd/system/odoo14.service: (Change the paths as per your environment)
ExecStart=/opt/odoo/odoo14-venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo.conf

You will face another issue If server restarts (from reaching a CPU or memory limit for example) or from a SIGHUP, _reexec() in odoo/service/server.py starts up Odoo using system Python executable, not virtual environment Python executable. Likely because of this line in _reexec():

exe = os.path.basename(sys.executable)

Solution:  Removing the os.path.basename from the line mentioned in _reexec() in file  odoo/service/server.py

Odoo in a virtual environment does not restart with correct Python executable · Issue #33479 · odoo/odoo (github.com)

--auto-reload, virtualenv and JetBrains PyCharm · Issue #5570 · odoo/odoo (github.com)  

Avatar
Discard
Related Posts Replies Views Activity
2
Dec 23
27728
0
Jun 21
3235
0
Feb 20
2154
4
Sep 18
11264
2
Feb 18
3859