simple celery run - ImportError: No module named celery - python

Trying to run a simple example according to
http://celery.readthedocs.org/en/latest/getting-started/next-steps.html
I'm getting ImportError: No module named celery (probably due to from celery import Celery).
On python shell it works perfectly.
Running: running python <proj dir>/celery_manager.py worker does work...
What am I doing wrong?
The full dump:
celery multi v3.1.16 (Cipater)
> Starting nodes...
Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib/python2.6/site-packages/celery/__main__.py", line 54, in <module>
main()
File "/usr/lib/python2.6/site-packages/celery/__main__.py", line 30, in main
main()
File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 81, in main
cmd.execute_from_commandline(argv)
File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 769, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 305, in execute_from_commandline
argv = self.setup_app_from_commandline(argv)
File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 465, in setup_app_from_commandline
self.app = self.find_app(app)
File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 485, in find_app
return find_app(app, symbol_by_name=self.symbol_by_name)
File "/usr/lib/python2.6/site-packages/celery/app/utils.py", line 248, in find_app
symbol_by_name=symbol_by_name, imp=imp,
File "/usr/lib/python2.6/site-packages/celery/app/utils.py", line 232, in find_app
sym = imp(app)
File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 64, in cwd_in_path
yield cwd
File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib/python2.6/site-packages/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named celery

Related

pyinstaller cannot open 'EndUpdateResourceW'

I tried to compile my app after updating pyinstaller, and it seems to run into this weird error:
Traceback (most recent call last):
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\core\ctypes\_util.py", line 64, in check_false
raise make_error(function, function_name)
OSError: [WinError 110] The system cannot open the device or file specified.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\users\\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\users\\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\\AppData\Local\Programs\Python\Python39\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 178, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 59, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 842, in main
build(specfile, distpath, workpath, clean_build)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 764, in build
exec(code, spec_namespace)
File "app.spec", line 30, in <module>
exe = EXE(
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 524, in __init__
self.__postinit__()
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
self.assemble()
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\api.py", line 692, in assemble
self.manifest.update_resources(build_name, [1])
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 904, in update_resources
UpdateManifestResourcesFromXML(dstpath, self.toprettyxml().encode("UTF-8"), names, languages)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 992, in UpdateManifestResourcesFromXML
winresource.UpdateResources(dstpath, xmlstr, RT_MANIFEST, names or [name], languages or [0, "*"])
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 189, in UpdateResources
win32api.EndUpdateResource(hdst, 0)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\win32api.py", line 229, in EndUpdateResource
_resource._EndUpdateResource(handle, discard)
File "C:\users\\appdata\local\programs\python\python39\lib\contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "C:\users\\appdata\local\programs\python\python39\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (110, 'EndUpdateResourceW', 'The system cannot open the device or file specified.')
Anyone ran into similar problems? I updated pyinstaller because I was running into issues with the google core hook, now that worked but this became an issue.

ModuleNotFoundError: No module named 'tornado' on ubuntu

When I am trying to run my application I got the following error
Traceback (most recent call last):
File "./app.py", line 32, in <module>
from pushservices.bootstrap import init_messaging_agents
File "/home/airnotifier/airnotifier/pushservices/bootstrap.py", line 2, in <module>
from .apns import *
File "/home/airnotifier/airnotifier/pushservices/apns.py", line 5, in <module>
from util import json_encode
File "/home/airnotifier/airnotifier/util.py", line 37, in <module>
import tornado
ModuleNotFoundError: No module named 'tornado'
I tried to run this command to install tornado
python3 -m pip install tornado
then I got the following message
Requirement already satisfied: tornado in /usr/local/lib/python3.8/dist-packages (6.0.3)
followed by the following error log
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 177, in emit
self.console.print(renderable, overflow="ignore", crop=False, style=style)
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1752, in print
extend(render(renderable, render_options))
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1390, in render
for render_output in iter_render:
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
for line in lines:
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/segment.py", line 245, in split_lines
for segment in segments:
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1368, in render
renderable = rich_cast(renderable)
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
renderable = cast_method()
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
pip_cmd = get_best_invocation_for_this_pip()
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
if found_executable and os.path.samefile(
File "/usr/lib/python3.8/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3.8'
Call stack:
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/dist-packages/pip/__main__.py", line 31, in <module>
sys.exit(_main())
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/main.py", line 70, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 101, in main
return self._main(args)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
self.handle_pip_version_check(options)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/req_command.py", line 148, in handle_pip_version_check
pip_self_version_check(session, options)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/self_outdated_check.py", line 237, in pip_self_version_check
logger.info("[present-rich] %s", upgrade_prompt)
File "/usr/lib/python3.8/logging/__init__.py", line 1446, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 179, in emit
self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.1.2', new='22.2.2'),)
can anyone please tell me what should I do and what is the problem ?
Here's a possible scenario that could cause this:
you execute pip install tornado as a user but you run the tornado project as another user.
Sorry for my terrible english, hope you can understand

Can not import matplotlib

I get the error NotImplementedError: Implement enable_gui in a subclass when trying to import matplotlib in vscode. Below is the full traceback. I am not sure what is the problem.
Traceback (most recent call last):
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
run()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/josecordova/Desktop/Michigan/sociallearning/dominance.py", line 11, in <module>
for filename in os.listdir('/Users/josecordova/Desktop/Michigan/sociallearning/LRPM_LR'):
File "/Users/josecordova/Desktop/Michigan/sociallearning/dominance.py", line 11, in <module>
for filename in os.listdir('/Users/josecordova/Desktop/Michigan/sociallearning/LRPM_LR'):
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py", line 945, in trace_dispatch
self.do_wait_suspend(thread, frame, event, arg)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_frame.py", line 164, in do_wait_suspend
self._args[0].do_wait_suspend(*args, **kwargs)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1949, in do_wait_suspend
keep_suspended = self._do_wait_suspend(thread, frame, event, arg, suspend_type, from_this_thread, frames_tracker)
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1971, in _do_wait_suspend
self._activate_mpl_if_needed()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1516, in _activate_mpl_if_needed
activate_function()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydevd.py", line 1505, in <lambda>
self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py", line 95, in activate_matplotlib
gui, backend = find_gui_and_backend()
File "/Users/josecordova/.vscode/extensions/ms-python.python-2021.7.1060902895/pythonFiles/lib/python/debugpy/_vendored/pydevd/pydev_ipython/matplotlibtools.py", line 47, in find_gui_and_backend
backend = matplotlib.rcParams['backend']
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/site-packages/matplotlib/__init__.py", line 831, in __getitem__
from matplotlib import pyplot as plt
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2362, in <module>
install_repl_displayhook()
File "/Users/josecordova/opt/anaconda3/envs/Research/lib/python3.8/site-packages/matplotlib/pyplot.py", line 126, in install_repl_displayhook
ip.enable_gui(ipython_gui_name)
File "/Users/josecordova/.local/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3470, in enable_gui
raise NotImplementedError('Implement enable_gui in a subclass')
NotImplementedError: Implement enable_gui in a subclass

Winrm error in while restarting the celeryd service

The module winrm is installed with all its dependencies, but still the celeryd service is not able to run. Here is the error trace:
worker1#man11idm01.stman00.isyntax.net: DOWN /usr/lib64/python2.6/site-packages/cryptography/__init__.py:26: DeprecationWarning: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of cryptography will drop support for Python 2.6 DeprecationWarning Traceback (most recent call last): File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name) File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals File "/usr/lib/python2.6/site-packages/celery/__main__.py", line 54, in <module>
main() File "/usr/lib/python2.6/site-packages/celery/__main__.py", line 30, in main
main() File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 81, in main
cmd.execute_from_commandline(argv) File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 769, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv))) File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 311, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:]) File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 761, in handle_argv
return self.execute(command, argv) File "/usr/lib/python2.6/site-packages/celery/bin/celery.py", line 693, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0]) File "/usr/lib/python2.6/site-packages/celery/bin/worker.py", line 179, in run_from_argv
return self(*args, **options) File "/usr/lib/python2.6/site-packages/celery/bin/base.py", line 274, in
__call__
ret = self.run(*args, **kwargs) File "/usr/lib/python2.6/site-packages/celery/bin/worker.py", line 212, in run
state_db=self.node_format(state_db, hostname), **kwargs File "/usr/lib/python2.6/site-packages/celery/worker/__init__.py", line 95, in __init__
self.app.loader.init_worker() File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 128, in init_worker
self.import_default_modules() File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 121, in import_default_modules
tuple(maybe_list(self.app.conf.CELERY_INCLUDE)) File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 103, in import_task_module
return self.import_from_cwd(module) File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 112, in import_from_cwd
package=package, File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package) File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback) File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 64, in cwd_in_path
yield cwd File "/usr/lib/python2.6/site-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package) File "/usr/lib/python2.6/site-packages/celery/loaders/base.py", line 106, in import_module
return importlib.import_module(module, package=package) File "/usr/lib/python2.6/site-packages/importlib/__init__.py", line 37, in import_module
__import__(name) File "/usr/lib/celery/phim_onsite/operate.py", line 14, in <module>
from phim_onsite.transmit import tx_data, tx_pcm_discovery, tx_deployment_status File "/usr/lib/celery/phim_onsite/transmit.py", line 19, in <module>
from scanline.trinity import scanline_endpoints, scanline_scanner File "/usr/lib/python2.6/site-packages/scanline/trinity.py", line 15, in <module>
from scanline.product.isp import ISPProductScanner File "/usr/lib/python2.6/site-packages/scanline/product/isp.py", line 17, in <module>
from scanline.host.isp import ISPHostScanner File "/usr/lib/python2.6/site-packages/scanline/host/isp.py", line 6, in <module>
from scanline.utilities.win_rm import extract_credentials File "/usr/lib/python2.6/site-packages/scanline/utilities/win_rm.py", line 2, in <module>
import winrm ImportError: No module named winrm
Restarting node worker1#man11idm01.stman00.isyntax.net: * Child terminated with errorcode 255
FAILED
+ exit 0

python celery no module named app.tasks

I am trying to run the demo application from Celery
the project directory is /usr/local/proj
[root#merit1 proj]# ls -lh
total 16K
-rw-r--r--. 1 root root 363 Dec 23 00:36 celery.py
-rw-r--r--. 1 root root 522 Dec 23 00:36 celery.pyc
-rw-r--r--. 1 root root 0 Dec 23 00:22 __init__.py
-rw-r--r--. 1 root root 114 Dec 23 00:36 __init__.pyc
-rw-r--r--. 1 root root 211 Dec 23 00:37 tasks.py
and celery.py
from __future__ import absolute_import
from celery import Celery
app = Celery('proj',
broker='amqp://guest#localhost//',
backend='amqp://',
include=['app.tasks'])
# Optional configuration, see the application user guide.
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
)
if __name__ == '__main__':
app.start()
and tasks.py contains
from __future__ import absolute_import
from proj.celery import app
#app.task
def add(x, y):
return x + y
#app.task
def mul(x, y):
return x * y
#app.task
def xsum(numbers):
return sum(numbers)
however when i run celery from /usr/local, i get this error
celery worker --app=proj -l info
Traceback (most recent call last):
File "/usr/bin/celery", line 9, in <module>
load_entry_point('celery==3.1.7', 'console_scripts', 'celery')()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/__main__.py", line 30, in main
main()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 80, in main
cmd.execute_from_commandline(argv)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 723, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/base.py", line 303, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 715, in handle_argv
return self.execute(command, argv)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 669, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/worker.py", line 175, in run_from_argv
return self(*args, **options)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/base.py", line 266, in __call__
ret = self.run(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/worker.py", line 208, in run
state_db=self.node_format(state_db, hostname), **kwargs
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/worker/__init__.py", line 95, in __init__
self.app.loader.init_worker()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 128, in init_worker
self.import_default_modules()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 121, in import_default_modules
tuple(maybe_list(self.app.conf.CELERY_INCLUDE))
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 103, in import_task_module
return self.import_from_cwd(module)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 112, in import_from_cwd
package=package,
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/utils/imports.py", line 64, in cwd_in_path
yield cwd
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 106, in import_module
return importlib.import_module(module, package=package)
File "/usr/lib/python2.6/site-packages/importlib-1.0.2-py2.6.egg/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named app.tasks
any ideas?
UPDATE:
updated celery.py to
from __future__ import absolute_import
from celery import Celery
app = Celery('proj',
broker='amqp://guest#localhost//',
backend='amqp://',
include=['proj.tasks'])
# Optional configuration, see the application user guide.
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,
)
if __name__ == '__main__':
app.start()
i now get this error
[root#merit1 local]# celery worker --app=proj -l info
Traceback (most recent call last):
File "/usr/bin/celery", line 9, in <module>
load_entry_point('celery==3.1.7', 'console_scripts', 'celery')()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/__main__.py", line 30, in main
main()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 80, in main
cmd.execute_from_commandline(argv)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 723, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/base.py", line 303, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 715, in handle_argv
return self.execute(command, argv)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/celery.py", line 669, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/worker.py", line 175, in run_from_argv
return self(*args, **options)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/base.py", line 266, in __call__
ret = self.run(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/bin/worker.py", line 208, in run
state_db=self.node_format(state_db, hostname), **kwargs
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/worker/__init__.py", line 95, in __init__
self.app.loader.init_worker()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 128, in init_worker
self.import_default_modules()
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 121, in import_default_modules
tuple(maybe_list(self.app.conf.CELERY_INCLUDE))
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 103, in import_task_module
return self.import_from_cwd(module)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 112, in import_from_cwd
package=package,
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/utils/imports.py", line 64, in cwd_in_path
yield cwd
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib/python2.6/site-packages/celery-3.1.7-py2.6.egg/celery/loaders/base.py", line 106, in import_module
return importlib.import_module(module, package=package)
File "/usr/lib/python2.6/site-packages/importlib-1.0.2-py2.6.egg/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/proj/tasks.py", line 8, in <module>
#app.task
TypeError: 'module' object is not callable
change your include to:
app = Celery('proj',
broker='amqp://guest#localhost//',
backend='amqp://',
include=['proj.tasks'])
see celery application doc
include – List of modules every worker should import.

Categories

Resources