'Odoo15 - ModuleNotFoundError: No module named 'PyPDF2'
I'm new to Odoo. I use pyenv to host odoo and all the dependencies. All under odoo system user, and I was able to start odoo service:
~# systemctl status odoo-15
● odoo-15.service - Odoo15
Loaded: loaded (/etc/systemd/system/odoo-15.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-02-18 22:33:40 UTC; 6min ago
Main PID: 61267 (python)
Tasks: 6 (limit: 2339)
Memory: 79.3M
CGroup: /system.slice/odoo-15.service
└─61267 /home/odoo/.pyenv/versions/odoo-15-env/bin/python /home/odoo/odoo-15/odoo-bin -c /home/odoo/.odoo_config
However, the service seems always stopped somehow automatically after around 1 hour due to PyPDF2 can't find:
Feb 18 16:10:28 ubuntu-s-1vcpu-2gb-sgp1-odoo systemd[1]: Started Odoo15.
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: Traceback (most recent call last):
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: File "/home/odoo/odoo-15/odoo-bin", line 5, in <module>
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: import odoo
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: File "/home/odoo/odoo-15/odoo/__init__.py", line 75, in <module>
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: import PyPDF2
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: ModuleNotFoundError: No module named 'PyPDF2'
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo systemd[1]: odoo-15.service: Main process exited, code=exited, status=1/FAILURE
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo systemd[1]: odoo-15.service: Failed with result 'exit-code'.
But I definitely have PyPDF2 in my pyenv
odoo@ubuntu-s-1vcpu-2gb-sgp1-odoo:~/odoo-15$ python
Python 3.9.2 (default, Feb 17 2022, 17:59:57)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyPDF2
>>> PyPDF2.__version__
'1.26.0'
I feel it's something to do with my virtualenv config, but I'm bit lost here.
Could you help to enlighten me on what could be wrong here? Thank you
Solution 1:[1]
If you already have a configured virtual environment . start your venv before running odoo server.
If not . Then you have to install all the dependencies, (which are in requirement.txt file in odoo directory).
Navigate to odoo folder and run pip install -r requirements.txt
. Hit enter. Let it install all packages and run your server again.
Solution 2:[2]
You need to activate virtual env and install Odoo requirements so:
sudo pip install -r requirements.txt
Or directly Install this module
pip3 install Pypdf2
Solution 3:[3]
check this link , it fixed here on blogger
https://shilalg.blogspot.com/2019/07/importerror-no-module-named-pypdf2.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Decoy |
Solution 2 | DharmanBot |
Solution 3 | Shilal |