There are many problems with the installation of source code #13514

Closed
opened 2026-02-21 19:12:28 -05:00 by yindo · 19 comments
Owner

Originally created by @good-miaozhun on GitHub (Apr 28, 2025).

Self Checks

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

Provide a description of requested docs changes

According to the source code startup instructions in the document, using the command: poetry env use 3.12 will result in the error "The Poetry configuration is invalid: - Either [project. version] or [tool. process. version] is required in package mode

Originally created by @good-miaozhun on GitHub (Apr 28, 2025). ### Self Checks - [ ] 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 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. ### Provide a description of requested docs changes According to the source code startup instructions in the document, using the command: poetry env use 3.12 will result in the error "The Poetry configuration is invalid: - Either [project. version] or [tool. process. version] is required in package mode
yindo added the 📚 documentation label 2026-02-21 19:12:28 -05:00
yindo closed this issue 2026-02-21 19:12:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 28, 2025):

Hello @miaozhunjiayou! I'm Dosu, your friendly bot here to help you solve bugs, answer questions, and guide you as a contributor. I'm here to assist you while we wait for a human maintainer. How can I help you today?

The error message you're encountering suggests that the pyproject.toml file might be missing required fields such as [project.version] or [tool.process.version]. This is necessary for Poetry to properly configure the environment.

To resolve this issue, you should check the pyproject.toml file in your project directory and ensure that it includes the necessary version specifications. Here's a basic example of what the pyproject.toml might need:

[tool.poetry]
name = "your-project-name"
version = "0.1.0"
description = "Your project description"
authors = ["Your Name <your.email@example.com>"]

[tool.poetry.dependencies]
python = ">=3.12,<3.13"

Make sure that the [tool.poetry] section includes a version field. If this section is missing or incomplete, add the necessary fields and values. After updating the file, try running the poetry env use 3.12 command again.

If the issue persists, you might want to check if there are any specific instructions or configurations required for your version of Poetry or the Dify project.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 28, 2025): <!-- Greeting --> Hello @miaozhunjiayou! I'm [Dosu](https://dosu.dev), your friendly bot here to help you solve bugs, answer questions, and guide you as a contributor. I'm here to assist you while we wait for a human maintainer. How can I help you today? <!-- Answer --> The error message you're encountering suggests that the `pyproject.toml` file might be missing required fields such as `[project.version]` or `[tool.process.version]`. This is necessary for Poetry to properly configure the environment. To resolve this issue, you should check the `pyproject.toml` file in your project directory and ensure that it includes the necessary version specifications. Here's a basic example of what the `pyproject.toml` might need: ```toml [tool.poetry] name = "your-project-name" version = "0.1.0" description = "Your project description" authors = ["Your Name <your.email@example.com>"] [tool.poetry.dependencies] python = ">=3.12,<3.13" ``` Make sure that the `[tool.poetry]` section includes a `version` field. If this section is missing or incomplete, add the necessary fields and values. After updating the file, try running the `poetry env use 3.12` command again. If the issue persists, you might want to check if there are any specific instructions or configurations required for your version of Poetry or the Dify project. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/9c65842f-996e-4b24-96c8-37b67eab9e44?feedback_type=other)</sup>
Author
Owner

@good-miaozhun commented on GitHub (Apr 28, 2025):

When I continue to execute poetry run flag run -- host 0.0.0.0-- port=5001-- debug, there will still be errors: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’ @dosu

@good-miaozhun commented on GitHub (Apr 28, 2025): When I continue to execute poetry run flag run -- host 0.0.0.0-- port=5001-- debug, there will still be errors: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’ @dosu
Author
Owner

@dosubot[bot] commented on GitHub (Apr 28, 2025):

The error you're encountering, AttributeError: type object 'datetime.datetime' has no attribute 'datetime', typically occurs when there's a misuse of the datetime module in Python. This error suggests that somewhere in the code, datetime.datetime is being incorrectly referenced as datetime.datetime.datetime.

To resolve this issue, check the code where the datetime module is being used. Ensure that you are correctly importing and using the datetime class. The correct usage should look like this:

from datetime import datetime

# Example usage
current_time = datetime.now()

If the code mistakenly uses datetime.datetime.datetime, it should be corrected to datetime.datetime or simply datetime if imported directly as shown above.

Review the relevant parts of your codebase where datetime is used and make sure the import statements and usage are correct. If you need further assistance, please provide the specific code snippet where the error occurs.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 28, 2025): <!-- Answer --> The error you're encountering, `AttributeError: type object 'datetime.datetime' has no attribute 'datetime'`, typically occurs when there's a misuse of the `datetime` module in Python. This error suggests that somewhere in the code, `datetime.datetime` is being incorrectly referenced as `datetime.datetime.datetime`. To resolve this issue, check the code where the `datetime` module is being used. Ensure that you are correctly importing and using the `datetime` class. The correct usage should look like this: ```python from datetime import datetime # Example usage current_time = datetime.now() ``` If the code mistakenly uses `datetime.datetime.datetime`, it should be corrected to `datetime.datetime` or simply `datetime` if imported directly as shown above. Review the relevant parts of your codebase where `datetime` is used and make sure the import statements and usage are correct. If you need further assistance, please provide the specific code snippet where the error occurs. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6fbb0953-15bd-4013-a0a5-cf86e96e0234?feedback_type=other)</sup>
Author
Owner

@kenwoodjw commented on GitHub (Apr 28, 2025):

Hi @miaozhunjiayou, please use this command, replace poetry to uv

uv run flask run --host 0.0.0.0 --port=5001 --debug

uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion

@kenwoodjw commented on GitHub (Apr 28, 2025): Hi @miaozhunjiayou, please use this command, replace `poetry` to `uv` ``` uv run flask run --host 0.0.0.0 --port=5001 --debug uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion ```
Author
Owner

@seven7vk commented on GitHub (Apr 29, 2025):

@miaozhunjiayou I meet the same problem: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’.....Did you solved this problem?

@seven7vk commented on GitHub (Apr 29, 2025): @miaozhunjiayou I meet the same problem: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’.....Did you solved this problem?
Author
Owner

@soulzzz commented on GitHub (Apr 29, 2025):

got same error here

System-Product-Name:~/dify/api$ uv run flask run --host 0.0.0.0 --port=5001 --debug
2025-04-29 05:21:07,669 INFO [utils.py:149]  Note: NumExpr detected 20 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 16.
2025-04-29 05:21:07,669 INFO [utils.py:162]  NumExpr defaulting to 16 threads.
2025-04-29 05:21:09,128 INFO [_client.py:1038]  HTTP Request: GET https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json "HTTP/1.1 200 OK"
Traceback (most recent call last):
  File "/home/sky/dify/api/.venv/bin/flask", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 1129, in main
    cli.main()
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 977, in run_command
    raise e from None
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 961, in run_command
    app: WSGIApplication = info.load_app()  # pyright: ignore
                           ^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 353, in load_app
    app = locate_app(import_name, None, raise_if_not_found=False)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 245, in locate_app
    __import__(module_name)
  File "/home/sky/dify/api/app.py", line 37, in <module>
    app = create_app()
          ^^^^^^^^^^^^
  File "/home/sky/dify/api/app_factory.py", line 32, in create_app
    initialize_extensions(app)
  File "/home/sky/dify/api/app_factory.py", line 98, in initialize_extensions
    ext.init_app(app)
  File "/home/sky/dify/api/extensions/ext_import_modules.py", line 5, in init_app
    from events import event_handlers  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/events/event_handlers/__init__.py", line 1, in <module>
    from .clean_when_dataset_deleted import handle
  File "/home/sky/dify/api/events/event_handlers/clean_when_dataset_deleted.py", line 2, in <module>
    from tasks.clean_dataset_task import clean_dataset_task
  File "/home/sky/dify/api/tasks/clean_dataset_task.py", line 7, in <module>
    from core.rag.index_processor.index_processor_factory import IndexProcessorFactory
  File "/home/sky/dify/api/core/rag/index_processor/index_processor_factory.py", line 7, in <module>
    from core.rag.index_processor.processor.qa_index_processor import QAIndexProcessor
  File "/home/sky/dify/api/core/rag/index_processor/processor/qa_index_processor.py", line 13, in <module>
    from core.llm_generator.llm_generator import LLMGenerator
  File "/home/sky/dify/api/core/llm_generator/llm_generator.py", line 22, in <module>
    from core.ops.ops_trace_manager import TraceQueueManager, TraceTask
  File "/home/sky/dify/api/core/ops/ops_trace_manager.py", line 40, in <module>
    from core.ops.weave_trace.weave_trace import WeaveDataTrace
  File "/home/sky/dify/api/core/ops/weave_trace/weave_trace.py", line 9, in <module>
    import weave
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/weave/__init__.py", line 14, in <module>
    from weave.flow.eval_imperative import EvaluationLogger
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/weave/flow/eval_imperative.py", line 183, in <module>
    class ScoreLogger(BaseModel):
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 224, in __new__
    complete_model_class(
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 577, in complete_model_class
    schema = cls.__get_pydantic_core_schema__(cls, handler)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/main.py", line 671, in __get_pydantic_core_schema__
    return handler(source)
           ^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in __call__
    schema = self._handler(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 655, in generate_schema
    schema = self._generate_schema_inner(obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 924, in _generate_schema_inner
    return self._model_schema(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 739, in _model_schema
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 739, in <dictcomp>
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1115, in _generate_md_field_schema
    common_field = self._common_field_schema(name, field_info, decorators)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1308, in _common_field_schema
    schema = self._apply_annotations(
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 2107, in _apply_annotations
    schema = get_inner_schema(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in __call__
    schema = self._handler(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 2088, in inner_handler
    schema = self._generate_schema_inner(obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 929, in _generate_schema_inner
    return self.match_type(obj)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1025, in match_type
    return self._dataclass_schema(obj, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1802, in _dataclass_schema
    fields = collect_dataclass_fields(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_fields.py", line 285, in collect_dataclass_fields
    ann_type = _typing_extra.eval_type_lenient(dataclass_field.type, types_namespace, cls_localns)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 257, in eval_type_lenient
    return eval_type_backport(value, globalns, localns)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 279, in eval_type_backport
    return _eval_type_backport(value, globalns, localns, type_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 303, in _eval_type_backport
    return _eval_type(value, globalns, localns, type_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 332, in _eval_type
    return typing._eval_type(  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/anaconda3/envs/dify/lib/python3.11/typing.py", line 395, in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sky/anaconda3/envs/dify/lib/python3.11/typing.py", line 905, in _evaluate
    eval(self.__forward_code__, globalns, localns),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'
@soulzzz commented on GitHub (Apr 29, 2025): got same error here ``` System-Product-Name:~/dify/api$ uv run flask run --host 0.0.0.0 --port=5001 --debug 2025-04-29 05:21:07,669 INFO [utils.py:149] Note: NumExpr detected 20 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 16. 2025-04-29 05:21:07,669 INFO [utils.py:162] NumExpr defaulting to 16 threads. 2025-04-29 05:21:09,128 INFO [_client.py:1038] HTTP Request: GET https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json "HTTP/1.1 200 OK" Traceback (most recent call last): File "/home/sky/dify/api/.venv/bin/flask", line 10, in <module> sys.exit(main()) ^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 1129, in main cli.main() File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 1082, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 1697, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 1443, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 788, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/decorators.py", line 92, in new_func return ctx.invoke(f, obj, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/click/core.py", line 788, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 977, in run_command raise e from None File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 961, in run_command app: WSGIApplication = info.load_app() # pyright: ignore ^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 353, in load_app app = locate_app(import_name, None, raise_if_not_found=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/flask/cli.py", line 245, in locate_app __import__(module_name) File "/home/sky/dify/api/app.py", line 37, in <module> app = create_app() ^^^^^^^^^^^^ File "/home/sky/dify/api/app_factory.py", line 32, in create_app initialize_extensions(app) File "/home/sky/dify/api/app_factory.py", line 98, in initialize_extensions ext.init_app(app) File "/home/sky/dify/api/extensions/ext_import_modules.py", line 5, in init_app from events import event_handlers # noqa: F401 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/events/event_handlers/__init__.py", line 1, in <module> from .clean_when_dataset_deleted import handle File "/home/sky/dify/api/events/event_handlers/clean_when_dataset_deleted.py", line 2, in <module> from tasks.clean_dataset_task import clean_dataset_task File "/home/sky/dify/api/tasks/clean_dataset_task.py", line 7, in <module> from core.rag.index_processor.index_processor_factory import IndexProcessorFactory File "/home/sky/dify/api/core/rag/index_processor/index_processor_factory.py", line 7, in <module> from core.rag.index_processor.processor.qa_index_processor import QAIndexProcessor File "/home/sky/dify/api/core/rag/index_processor/processor/qa_index_processor.py", line 13, in <module> from core.llm_generator.llm_generator import LLMGenerator File "/home/sky/dify/api/core/llm_generator/llm_generator.py", line 22, in <module> from core.ops.ops_trace_manager import TraceQueueManager, TraceTask File "/home/sky/dify/api/core/ops/ops_trace_manager.py", line 40, in <module> from core.ops.weave_trace.weave_trace import WeaveDataTrace File "/home/sky/dify/api/core/ops/weave_trace/weave_trace.py", line 9, in <module> import weave File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/weave/__init__.py", line 14, in <module> from weave.flow.eval_imperative import EvaluationLogger File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/weave/flow/eval_imperative.py", line 183, in <module> class ScoreLogger(BaseModel): File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 224, in __new__ complete_model_class( File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 577, in complete_model_class schema = cls.__get_pydantic_core_schema__(cls, handler) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/main.py", line 671, in __get_pydantic_core_schema__ return handler(source) ^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in __call__ schema = self._handler(source_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 655, in generate_schema schema = self._generate_schema_inner(obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 924, in _generate_schema_inner return self._model_schema(obj) ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 739, in _model_schema {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 739, in <dictcomp> {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1115, in _generate_md_field_schema common_field = self._common_field_schema(name, field_info, decorators) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1308, in _common_field_schema schema = self._apply_annotations( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 2107, in _apply_annotations schema = get_inner_schema(source_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in __call__ schema = self._handler(source_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 2088, in inner_handler schema = self._generate_schema_inner(obj) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 929, in _generate_schema_inner return self.match_type(obj) ^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1025, in match_type return self._dataclass_schema(obj, None) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py", line 1802, in _dataclass_schema fields = collect_dataclass_fields( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_fields.py", line 285, in collect_dataclass_fields ann_type = _typing_extra.eval_type_lenient(dataclass_field.type, types_namespace, cls_localns) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 257, in eval_type_lenient return eval_type_backport(value, globalns, localns) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 279, in eval_type_backport return _eval_type_backport(value, globalns, localns, type_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 303, in _eval_type_backport return _eval_type(value, globalns, localns, type_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/dify/api/.venv/lib/python3.11/site-packages/pydantic/_internal/_typing_extra.py", line 332, in _eval_type return typing._eval_type( # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/anaconda3/envs/dify/lib/python3.11/typing.py", line 395, in _eval_type return t._evaluate(globalns, localns, recursive_guard) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sky/anaconda3/envs/dify/lib/python3.11/typing.py", line 905, in _evaluate eval(self.__forward_code__, globalns, localns), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<string>", line 1, in <module> AttributeError: type object 'datetime.datetime' has no attribute 'datetime' ```
Author
Owner

@good-miaozhun commented on GitHub (Apr 29, 2025):

Hi @miaozhunjiayou, please use this command, replace poetry to uv你好,请使用这个命令,将 poetry 替换为 uv

uv run flask run --host 0.0.0.0 --port=5001 --debug

uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion

Thank you, I followed your suggestion, but it still produces errors

@good-miaozhun commented on GitHub (Apr 29, 2025): > Hi [@miaozhunjiayou](https://github.com/miaozhunjiayou), please use this command, replace `poetry` to `uv`你好,请使用这个命令,将 `poetry` 替换为 `uv` > > ``` > uv run flask run --host 0.0.0.0 --port=5001 --debug > > uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion > ``` Thank you, I followed your suggestion, but it still produces errors
Author
Owner

@good-miaozhun commented on GitHub (Apr 29, 2025):

@miaozhunjiayou I meet the same problem: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’.....Did you solved this problem?我遇到了同样的问题:AttributeError:类型对象“datetime.datetime”没有属性“datetime”.....你解决了这个问题吗?

It hasn't been resolved yet

@good-miaozhun commented on GitHub (Apr 29, 2025): > [@miaozhunjiayou](https://github.com/miaozhunjiayou) I meet the same problem: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’.....Did you solved this problem?我遇到了同样的问题:AttributeError:类型对象“datetime.datetime”没有属性“datetime”.....你解决了这个问题吗? It hasn't been resolved yet
Author
Owner

@kenwoodjw commented on GitHub (Apr 29, 2025):

It seems encountered this bug
https://github.com/wandb/weave/pull/4311
PR from
https://github.com/langgenius/dify/pull/14262

@kenwoodjw commented on GitHub (Apr 29, 2025): It seems encountered this bug https://github.com/wandb/weave/pull/4311 PR from https://github.com/langgenius/dify/pull/14262
Author
Owner

@soulzzz commented on GitHub (Apr 29, 2025):

It seems encountered this bug wandb/weave#4311 PR from #14262

any temp resolution? or just revert this PR

@soulzzz commented on GitHub (Apr 29, 2025): > It seems encountered this bug [wandb/weave#4311](https://github.com/wandb/weave/pull/4311) PR from [#14262](https://github.com/langgenius/dify/pull/14262) any temp resolution? or just revert this PR
Author
Owner

@kenwoodjw commented on GitHub (Apr 29, 2025):

@soulzzz Pull the latest source code

@kenwoodjw commented on GitHub (Apr 29, 2025): @soulzzz Pull the latest source code
Author
Owner

@seven7vk commented on GitHub (Apr 29, 2025):

Hi @miaozhunjiayou, please use this command, replace poetry to uv

uv run flask run --host 0.0.0.0 --port=5001 --debug

uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion

Thanks!That's ture

@seven7vk commented on GitHub (Apr 29, 2025): > Hi [@miaozhunjiayou](https://github.com/miaozhunjiayou), please use this command, replace `poetry` to `uv` > > ``` > uv run flask run --host 0.0.0.0 --port=5001 --debug > > uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion > ``` Thanks!That's ture
Author
Owner

@good-miaozhun commented on GitHub (Apr 29, 2025):

Hi @miaozhunjiayou, please use this command, replace poetry to uv你好 @miaozhunjiayou ,请使用这个命令,将 poetry 替换为 uv

uv run flask run --host 0.0.0.0 --port=5001 --debug

uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion

Thanks!That's ture  谢谢!确实如此

But using the above command on my platform still cannot solve it, and new problems may arise @kenwoodjw

error: Distribution onnxruntime==1.21.0 @ registry+https:pypi.org/simple can't be installed because it doesn't have a source distribution or wheel for the current platform

@good-miaozhun commented on GitHub (Apr 29, 2025): > > Hi [@miaozhunjiayou](https://github.com/miaozhunjiayou), please use this command, replace `poetry` to `uv`你好 [@miaozhunjiayou](https://github.com/miaozhunjiayou) ,请使用这个命令,将 `poetry` 替换为 `uv` > > ``` > > uv run flask run --host 0.0.0.0 --port=5001 --debug > > > > uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion > > ``` > > Thanks!That's ture  谢谢!确实如此 But using the above command on my platform still cannot solve it, and new problems may arise @kenwoodjw error: Distribution `onnxruntime==1.21.0 @ registry+https:pypi.org/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform
Author
Owner

@safura310 commented on GitHub (Apr 29, 2025):

Hi @miaozhunjiayou, please use this command, replace poetry to uv

uv run flask run --host 0.0.0.0 --port=5001 --debug

uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion

Thanks, but i wonder why i need to use uv replace poetry.

@safura310 commented on GitHub (Apr 29, 2025): > Hi [@miaozhunjiayou](https://github.com/miaozhunjiayou), please use this command, replace `poetry` to `uv` > > ``` > uv run flask run --host 0.0.0.0 --port=5001 --debug > > uv run celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion > ``` Thanks, but i wonder why i need to use uv replace poetry.
Author
Owner

@Sakura4036 commented on GitHub (Apr 29, 2025):

When I continue to execute poetry run flag run -- host 0.0.0.0-- port=5001-- debug, there will still be errors: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’ @dosu

+1.

uv run flask run --host 0.0.0.0 --port=5001 --debug it works, but i do want use miniconda3 instead uv venv.

I use miniconda env, but i use uv pip install -r pyproject.toml to download packages. Then i use flask run --host 0.0.0.0 --port=5001 --debug to start the dify api worker, got the same error. how do i fix it?

@Sakura4036 commented on GitHub (Apr 29, 2025): > When I continue to execute poetry run flag run -- host 0.0.0.0-- port=5001-- debug, there will still be errors: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’ [@dosu](https://github.com/dosu) +1. `uv run flask run --host 0.0.0.0 --port=5001 --debug` it works, but i do want use `miniconda3` instead `uv venv`. I use miniconda env, but i use `uv pip install -r pyproject.toml` to download packages. Then i use `flask run --host 0.0.0.0 --port=5001 --debug` to start the dify api worker, got the same error. how do i fix it?
Author
Owner

@arjunw3nuts commented on GitHub (Apr 29, 2025):

uv run flask db upgrade

On running this command getting
AttributeError: module 'h11' has no attribute 'Request'

@arjunw3nuts commented on GitHub (Apr 29, 2025): uv run flask db upgrade On running this command getting AttributeError: module 'h11' has no attribute 'Request'
Author
Owner

@kenwoodjw commented on GitHub (Apr 29, 2025):

uv run flask db upgrade

Did you run uv sync?

@kenwoodjw commented on GitHub (Apr 29, 2025): > uv run flask db upgrade Did you run `uv sync`?
Author
Owner

@kenwoodjw commented on GitHub (Apr 29, 2025):

When I continue to execute poetry run flag run -- host 0.0.0.0-- port=5001-- debug, there will still be errors: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’ @dosu

+1.

uv run flask run --host 0.0.0.0 --port=5001 --debug it works, but i do want use miniconda3 instead uv venv.

I use miniconda env, but i use uv pip install -r pyproject.toml to download packages. Then i use flask run --host 0.0.0.0 --port=5001 --debug to start the dify api worker, got the same error. how do i fix it?

try to remove uv.lock or poetry.lock, and run again

@kenwoodjw commented on GitHub (Apr 29, 2025): > > When I continue to execute poetry run flag run -- host 0.0.0.0-- port=5001-- debug, there will still be errors: AttributeError: type object 'datetime.datetime' has no attribute 'datetime’ [@dosu](https://github.com/dosu) > > +1. > > `uv run flask run --host 0.0.0.0 --port=5001 --debug` it works, but i do want use `miniconda3` instead `uv venv`. > > I use miniconda env, but i use `uv pip install -r pyproject.toml` to download packages. Then i use `flask run --host 0.0.0.0 --port=5001 --debug` to start the dify api worker, got the same error. how do i fix it? try to remove `uv.lock` or `poetry.lock`, and run again
Author
Owner

@arjunw3nuts commented on GitHub (Apr 29, 2025):

Thanks @kenwoodjw, deleting the uv.lock and running again did the trick.

@arjunw3nuts commented on GitHub (Apr 29, 2025): Thanks @kenwoodjw, deleting the uv.lock and running again did the trick.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13514