Error when starting celery #6675

Closed
opened 2026-02-21 18:16:48 -05:00 by yindo · 1 comment
Owner

Originally created by @jlokys on GitHub (Nov 11, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.11.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Starting celery reports the following error, and opening the command line window as an administrator does not work either

celery -A app.celery worker -P solo --without-gossip --without-mingle -Q dataset,generation,mail,ops_trace --loglevel INFO
None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "E:\dify\api.venv\Scripts\celery.exe__main__.py", line 7, in
File "E:\dify\api.venv\Lib\site-packages\celery__main__.py", line 15, in main
sys.exit(_main())
^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\bin\celery.py", line 236, in main
return celery(auto_envvar_prefix="CELERY")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\bin\base.py", line 135, in caller
return f(ctx, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\bin\worker.py", line 348, in worker
worker = app.Worker(
^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\worker\worker.py", line 98, in init
self.setup_instance(**self.prepare_args(**kwargs))
File "E:\dify\api.venv\Lib\site-packages\celery\worker\worker.py", line 131, in setup_instance
self.on_init_blueprint()
File "E:\dify\api.venv\Lib\site-packages\celery\apps\worker.py", line 116, in on_init_blueprint
self._custom_logging = self.setup_logging()
^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\apps\worker.py", line 180, in setup_logging
return self.app.log.setup(
^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\app\log.py", line 63, in setup
handled = self.setup_logging_subsystem(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\app\log.py", line 117, in setup_logging_subsystem
self._configure_logger(
File "E:\dify\api.venv\Lib\site-packages\celery\app\log.py", line 150, in _configure_logger
self.setup_handlers(logger, logfile, format,
File "E:\dify\api.venv\Lib\site-packages\celery\app\log.py", line 216, in setup_handlers
handler = self._detect_handler(logfile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\dify\api.venv\Lib\site-packages\celery\app\log.py", line 226, in _detect_handler
return WatchedFileHandler(logfile, encoding='utf-8')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\dev_tools\python\Lib\logging\handlers.py", line 475, in init
logging.FileHandler.init(self, filename, mode=mode,
File "D:\dev_tools\python\Lib\logging_init_.py", line 1181, in init
StreamHandler.init(self, self._open())
^^^^^^^^^^^^
File "D:\dev_tools\python\Lib\logging_init_.py", line 1213, in _open
return open_func(self.baseFilename, self.mode,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'E:\dify\api'

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @jlokys on GitHub (Nov 11, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.11.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce Starting celery reports the following error, and opening the command line window as an administrator does not work either >celery -A app.celery worker -P solo --without-gossip --without-mingle -Q dataset,generation,mail,ops_trace --loglevel INFO None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used. Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "E:\dify\api\.venv\Scripts\celery.exe\__main__.py", line 7, in <module> File "E:\dify\api\.venv\Lib\site-packages\celery\__main__.py", line 15, in main sys.exit(_main()) ^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\bin\celery.py", line 236, in main return celery(auto_envvar_prefix="CELERY") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\click\decorators.py", line 33, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\bin\base.py", line 135, in caller return f(ctx, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\bin\worker.py", line 348, in worker worker = app.Worker( ^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\worker\worker.py", line 98, in __init__ self.setup_instance(**self.prepare_args(**kwargs)) File "E:\dify\api\.venv\Lib\site-packages\celery\worker\worker.py", line 131, in setup_instance self.on_init_blueprint() File "E:\dify\api\.venv\Lib\site-packages\celery\apps\worker.py", line 116, in on_init_blueprint self._custom_logging = self.setup_logging() ^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\apps\worker.py", line 180, in setup_logging return self.app.log.setup( ^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\app\log.py", line 63, in setup handled = self.setup_logging_subsystem( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\app\log.py", line 117, in setup_logging_subsystem self._configure_logger( File "E:\dify\api\.venv\Lib\site-packages\celery\app\log.py", line 150, in _configure_logger self.setup_handlers(logger, logfile, format, File "E:\dify\api\.venv\Lib\site-packages\celery\app\log.py", line 216, in setup_handlers handler = self._detect_handler(logfile) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\dify\api\.venv\Lib\site-packages\celery\app\log.py", line 226, in _detect_handler return WatchedFileHandler(logfile, encoding='utf-8') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\dev_tools\python\Lib\logging\handlers.py", line 475, in __init__ logging.FileHandler.__init__(self, filename, mode=mode, File "D:\dev_tools\python\Lib\logging\__init__.py", line 1181, in __init__ StreamHandler.__init__(self, self._open()) ^^^^^^^^^^^^ File "D:\dev_tools\python\Lib\logging\__init__.py", line 1213, in _open return open_func(self.baseFilename, self.mode, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: 'E:\\dify\\api' ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:16:48 -05:00
yindo closed this issue 2026-02-21 18:16:48 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 11, 2024):

The PermissionError: [Errno 13] Permission denied indicates that the Celery process does not have the necessary permissions to access or create the log file at the specified path 'E:\\dify\\api'. Here are some steps you can take to resolve this issue:

  1. Check File Permissions: Ensure that the directory 'E:\\dify\\api' and any subdirectories have the correct permissions set to allow the user running the Celery process to write to them. You can do this by right-clicking the directory, selecting "Properties," and adjusting the permissions under the "Security" tab.

  2. Run as Administrator: Although you mentioned that running the command line as an administrator did not work, double-check that the command prompt or terminal you are using has elevated permissions. You can try running the command in a new terminal window opened with "Run as administrator."

  3. Specify a Different Log File Path: If the current path is problematic, you can try specifying a different log file path in the Celery configuration that you know is writable. Update the dify_config.LOG_FILE setting to point to a directory where you have confirmed write access.

  4. Check for Open File Handles: Ensure that no other process is holding a lock on the log file or directory, which might prevent Celery from accessing it.

  5. Verify Environment Variables: Make sure that any environment variables related to logging paths are correctly set and point to accessible locations.

If these steps do not resolve the issue, consider checking the system's event logs for additional information on why the permission is being denied.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 11, 2024): <!-- Answer --> The `PermissionError: [Errno 13] Permission denied` indicates that the Celery process does not have the necessary permissions to access or create the log file at the specified path `'E:\\dify\\api'`. Here are some steps you can take to resolve this issue: 1. **Check File Permissions**: Ensure that the directory `'E:\\dify\\api'` and any subdirectories have the correct permissions set to allow the user running the Celery process to write to them. You can do this by right-clicking the directory, selecting "Properties," and adjusting the permissions under the "Security" tab. 2. **Run as Administrator**: Although you mentioned that running the command line as an administrator did not work, double-check that the command prompt or terminal you are using has elevated permissions. You can try running the command in a new terminal window opened with "Run as administrator." 3. **Specify a Different Log File Path**: If the current path is problematic, you can try specifying a different log file path in the Celery configuration that you know is writable. Update the `dify_config.LOG_FILE` setting to point to a directory where you have confirmed write access. 4. **Check for Open File Handles**: Ensure that no other process is holding a lock on the log file or directory, which might prevent Celery from accessing it. 5. **Verify Environment Variables**: Make sure that any environment variables related to logging paths are correctly set and point to accessible locations. If these steps do not resolve the issue, consider checking the system's event logs for additional information on why the permission is being denied. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6675