Разрешение конфликта зависимостей при работе с UV

    В процессе освоения инструмента UV возникла следующая ситуация. Для нового проекта была создана директория с помощью команды:

    uv init myproject

    После перехода в созданную папку была выполнена команда для установки зависимостей из файла req.txt, взятого из проекта Whisper-Live (доступного на GitHub):

    uv add -r req.txt

    Однако выполнение команды завершилось ошибкой со следующим сообщением:

    x No solution found when resolving dependencies for split (markers: python_full_version >= '3.13'):
    `-> Because only the following versions of ml-dtypes are available:
    ml-dtypes<=0.5.0
    ml-dtypes==0.5.1
    ml-dtypes==0.5.3
    ml-dtypes==0.5.4
    and ml-dtypes>=0.5.0 depends on numpy{python_full_version >= '3.13'}>=2.1.0, we can conclude that
    ml-dtypes>=0.5.0 depends on numpy>=2.1.0.
    And because onnx==1.20.0 depends on ml-dtypes>=0.5.0, we can conclude that onnx==1.20.0 depends on numpy>=2.1.0.
    And because your project depends on numpy==1.26.4 and onnx==1.20.0, we can conclude that your project's
    requirements are unsatisfiable.

    hint: While the active Python version is 3.12, the resolution failed for other Python versions supported by your
    project. Consider limiting your project's supported Python versions using `requires-python`.
    help: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip
    locking and syncing.

    Альтернативный подход и возникшие вопросы

    Интересно, что команда:

    uv pip install -r req.txt

    успешно устанавливает все зависимости без ошибок. В итоге именно этот способ был использован для продолжения работы.

    Ключевые вопросы для понимания

    • Почему возникает такое расхождение в поведении между uv add и uv pip install?
    • Является ли использование uv pip install корректным решением в данной ситуации?
    • Правильно ли продолжать использовать uv pip install, или всё же следует разобраться с uv add для соблюдения лучших практик?