Hi
I'm killing my head trying to get Odoo 18 Enterprise to run in a Python venv due to dependencies for some modules.
I have tried to run Odoo using the python of the venv but it doesn't work, same if I modify the systemd init script.
Installation is done on Debian 12 using deb packages supplied by Odoo.
Thanks
Vincèn
Hello,
It exists on your server: /opt/odoo/odoo-bin
Run this to confirm:
ls -la /opt/odoo/odoo-bin
If you downloaded a different archive missing it, just create it:
cat > /opt/odoo/odoo-bin << 'EOF'
#!/usr/bin/env python3
__import__('os').environ['TZ'] = 'UTC'
import odoo
if __name__ == "__main__":
odoo.cli.main()
EOF
chmod +x /opt/odoo/odoo-bin
in /opt/odoo I have only a subdirectory odoo where are all files coming from Odoo archive for source and my venv directory !
What you describe as content for odoo-bin is the content I have in the odoo file in the subdirectory /opt/odoo/odoo/setup
Sorry but I'm completely lost now about what to do
Hello,
Provide details here about what you have done and what you want to achieve?
Hello, can you try that
sudo sed -i 's|/opt/odoo/odoo/setup/odoo|/opt/odoo/odoo-bin|' /etc/systemd/system/odoo.service && sudo systemctl daemon-reload && sudo systemctl restart odoo
Well my goal is to be able to run Odoo 18 Enterprise with venv Python environnment so I can install some Python dependencies in venv needed for some extra modules in Odoo !
So far, I have tried multiple ways using either the deb supplied by Odoo or the source archive supplied by Odoo. I have created an odoo user in a clean debian 12 install, copied the extracted archive supplied by odoo into it, installed a venv in the odoo user and created a sysinit file to start odoo using the venv environnment. Whatever I do it using the deb package or the source archive I end up with the same error listed in my previous message !
I tried the command line you shared but still same error:
root@odoo18:~# systemctl status odoo
× odoo.service - Odoo
Loaded: loaded (/etc/systemd/system/odoo.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Wed 2025-12-10 12:15:54 CET; 11s ago
Duration: 9ms
Process: 143059 ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo-bin -c /etc/odoo.conf (code=exited, status=1/FAILURE)
Main PID: 143059 (code=exited, status=1/FAILURE)
CPU: 9ms
déc 10 12:15:54 odoo18 systemd[1]: Started odoo.service - Odoo.
déc 10 12:15:54 odoo18 odoo[143059]: Traceback (most recent call last):
déc 10 12:15:54 odoo18 odoo[143059]: File "/opt/odoo/odoo-bin", line 8, in <module>
déc 10 12:15:54 odoo18 odoo[143059]: odoo.cli.main()
déc 10 12:15:54 odoo18 odoo[143059]: ^^^^^^^^
déc 10 12:15:54 odoo18 odoo[143059]: AttributeError: module 'odoo' has no attribute 'cli'
déc 10 12:15:54 odoo18 systemd[1]: odoo.service: Main process exited, code=exited, status=1/FAILURE
déc 10 12:15:54 odoo18 systemd[1]: odoo.service: Failed with result 'exit-code'.
root@odoo18:~#
Ok some questions in my mind
Why you want to use venv only for enterprise?
Extra modules meaning in this context?
Have you tried with this "source venv/bin/activate"?
Hi @codsphere tech
Not sure to understand your question about venv only for Odoo Enterprise ??
Extra modules means some apps made by third parties (Odoo partners) that I want to install in Odoo and that have some Python dependencies that only exists in pip3 and not in Python itself and so needs Odoo to run in venv.
I have tried already the activate before trying to start Odoo but no changes, same error :(
Hello,
Odoo not installed in venv. Fix:
source /opt/odoo/odoo-venv/bin/activate
pip install -e /opt/odoo
deactivate
sudo systemctl restart odoo
Or add PYTHONPATH to service file:
sudo systemctl edit odoo
[Service]
Environment="PYTHONPATH=/opt/odoo"
sudo systemctl daemon-reload && sudo systemctl restart odoo
hope it helps
If you are not using multiple versions on the same server then you can install dependencies using pip install module_name..
First try without extra modules and if the odoo start then you can add that modules.
ExecStart= /pathofyourvirtualenv/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf
Hi Kunjan
I added as you suggested the Python path variable in init script file but still the exact same error at startup :(
For venv it's well installed in odoo home directory already.
Hi Codesphere,
It's exactly what I'm trying to do since days without any success. I'm unable to run Odoo in a venv environnment, it always fails whatever I'm using the deb supplied by Odoo or the zip archive.
I'n also very confused why all Odoo documentations or tutorials on Internet speaks about odoo-bin file that doesn't exist neither in the deb version neither in the zip file of sources....
No more ideas about what the problem is ?
If it is possible in your case, try with cloning the odoo addons.
Cloning addons ? my main problem is to be able to use Odoo with pip dependencies which so far doesn't work being unable to get Odoo work with venv !
Deb Package
/usr/bin/odoo -c /etc/odoo/odoo.conf
venv (Use Git instead)
git clone https://github.com/odoo/odoo.git --depth 1 --branch 18.0
cd odoo
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
./odoo-bin
Deb + venv = Don't mix. Use Git for venv.
hope it helps.
Hi Kunjan
Thanks for your email but unhappy I'm "just" an Odoo customer and not a partner so no access at Odoo Github for Enterprise version and if I use the source archives supplied by Odoo it doesn't work :(
Vincèn