novacode-nl / odoo-celery

Odoo & Celery integration
GNU Lesser General Public License v3.0
42 stars 44 forks source link

Unable to install module "celery" #25

Closed omushpapa closed 4 years ago

omushpapa commented 4 years ago

I am getting Unable to install module "celery" because an external dependency is not met: No module named celery when trying to install the module on Odoo 12 with python 3.6.5

bobslee commented 4 years ago

The required Python package celery needs to be installed - also mentioned in documentation.

On commandline:

pip install celery

If it not works..due to pip linking with Python2.7, try:

pip3 install celery

omushpapa commented 4 years ago

I should have given more information. The python package celery is already installed on Odoo's python environment. On installing this module, Odoo's _check_external_dependencies runs importlib.import_module('celery') which raises

# This is run in PyCharm's debug mode
Traceback (most recent call last):
  File "/home/aswa/applications/pycharm-community-2019.1.3/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
  File "/home/aswa/.local/share/virtualenvs/twelve-YNQc9i_8/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/aswa/v12_dev/celery/__init__.py", line 4, in <module>
    from . import odoo
  File "/home/aswa/applications/pycharm-community-2019.1.3/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/home/aswa/v12_dev/celery/odoo.py", line 6, in <module>
    from celery import Celery
ImportError: cannot import name 'Celery'

In my belief, the line from celery import Celery imports this Odoo module instead of the Python module. The issue being that both modules have the same name.

I believe, the resolution would be changing the Odoo module's name from celery to odoo_celery

bobslee commented 4 years ago

Hi @giantas, thanks for the info.

Several projects which use this module (v10, v11, v12), never encountered such error before. I even just tested the complete module with a Celery worker started - No error. So that's quite odd :)

Again I've some questions:

  1. On which Operating System (and release) you installed Odoo and run the Celery worker on?

  2. I don't expect, but maybe it's module version related. So please let me know which version of the Odoo module you use (expect the latest?)

  3. When does the problem occur? Upon starting the Odoo server or Celery worker(s)?

  4. I also ponder whether this problem is PyCharm (IDE) related. Maybe PyCharm mingles with the PYTHONPATH ? If not yet, try to run the Odoo server and Celery worker with commandline. Please Let me know the outcome.

I won't change the module name, because there's no reason and I can't reproduce.

Let's hope we can solve your issue :)

bobslee commented 4 years ago

@giantas are you able to provide me the info? Would like to analyse this issue further.

bobslee commented 4 years ago

I closed this report. It's not obvious or reproducable without extra information.