我已经成功安装了flags包:

pip install flags                                                                                                                                                                                                       ─╯
Collecting flags
  Downloading flags-0.0.1.2.tar.gz (1.0 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: flags
  Building wheel for flags (pyproject.toml) ... done
  Created wheel for flags: filename=flags-0.0.1.2-py3-none-any.whl size=1698 sha256=9f7a6085b3e27960f9a56d8a3e2cb4781e1f6369fd572ab5610df42e745559ae
  Stored in directory: /Users/l028/Library/Caches/pip/wheels/1a/fc/32/fdc14bda566c3b37624cad853634811349fe105b21a829e7e5
Successfully built flags
Installing collected packages: flags
Successfully installed flags-0.0.1.2

然而,当我运行要求该依赖项为flags的llmstack时,我不断得到这个错误:

llmstack                                                                                                                                                                                                                ─╯
/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/llmstack/apps/apps.py:47: RuntimeWarning: coroutine 'SyncToAsync.__call__' was never awaited
  sync_to_async(add_missing_app_types)()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/db/backends/utils.py:98: RuntimeWarning: Accessing the database during app initialization is discouraged. To fix this warning, avoid executing queries in AppConfig.ready() or when your app modules are imported.
  warnings.warn(self.APPS_NOT_READY_WARNING_MSG, category=RuntimeWarning)
Traceback (most recent call last):
  File "/Users/l028/.pyenv/versions/llm_stack/bin/llmstack", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/llmstack/cli.py", line 308, in main
    run_django_command(["manage.py", "migrate", "--noinput"])
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/llmstack/cli.py", line 18, in run_django_command
    execute_from_command_line(command)
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/commands/migrate.py", line 100, in handle
    self.check(databases=[database])
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/management/base.py", line 486, in check
    all_issues = checks.run_checks(
                 ^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
           ^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/urls/resolvers.py", line 519, in check
    for pattern in self.url_patterns:
                   ^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/urls/resolvers.py", line 738, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
                       ^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/urls/resolvers.py", line 731, in urlconf_module
    return import_module(self.urlconf_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/llmstack/server/urls.py", line 7, in <module>
    path("", include("llmstack.apps.urls")),
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/django/urls/conf.py", line 39, in include
    urlconf_module = import_module(urlconf_module)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/l028/.pyenv/versions/3.11.8/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/llmstack/apps/urls.py", line 3, in <module>
    from . import apis
  File "/Users/l028/.pyenv/versions/3.11.8/envs/llm_stack/lib/python3.11/site-packages/llmstack/apps/apis.py", line 15, in <module>
    from flags.state import flag_enabled
ModuleNotFoundError: No module named 'flags.state'; 'flags' is not a package

问题出在哪里以及如何解决它?

推荐答案

pip install flags安装https://pypi.org/project/flags/,它只提供模块flags.py,不提供任何包,不提供子模块,因此没有flgas.state.您需要不同的包django-flags.所以首先卸载flags并安装django-flags:

pip uninstall -y flags
pip install django-flags

https://github.com/trypromptly/LLMStack/issues处报告问题

Python相关问答推荐

如何通过多2多字段过滤查询集

如何自动抓取以下CSV

根据不同列的值在收件箱中移动数据

为什么我的Python代码在if-else声明中的行之前执行if-else声明中的行?

追溯(最近最后一次调用):文件C:\Users\Diplom/PycharmProject\Yolo01\Roboflow-4.py,第4行,在模块导入roboflow中

按顺序合并2个词典列表

在Mac上安装ipython

将tdqm与cx.Oracle查询集成

如何在WSL2中更新Python到最新版本(3.12.2)?

提取相关行的最快方法—pandas

isinstance()在使用dill.dump和dill.load后,对列表中包含的对象失败

Flask Jinja2如果语句总是计算为false&

如何使用使用来自其他列的值的公式更新一个rabrame列?

通过追加列表以极向聚合

Polars map_使用多处理对UDF进行批处理

查看pandas字符列是否在字符串列中

数据框,如果值在范围内,则获取范围和

有没有办法在不先将文件写入内存的情况下做到这一点?

提取最内层嵌套链接

极柱内丢失类型信息""