できない.dev

uv「No solution found when resolving dependencies」の原因と直し方

uv の No solution found when resolving dependencies は、依存の条件をすべて満たす版が無いと出る。
cause の最後の行が衝突した条件を示すので、版の指定か requires-python をそれに合わせれば直る。

公開: 更新:

症状できない · exit 1
uv add requests==99.0
…
error: Failed to add dependencies
  cause: No solution found when resolving dependencies
  cause: Because there is no version of requests==99.0 and your project depends on requests==99.0, we can conclude that your project's requirements are unsatisfiable.
解決後できた · exit 0
uv add requests==2.31.0 "urllib3>=2"
…
 + charset-normalizer==3.5.2
 + idna==3.20
 + requests==2.31.0
 + urllib3==2.8.0

2026-11-07 に python:3.12(uv 0.13.7) で実際に打って取った出力。検証環境の詳細

要約

uv add で依存を解決できないと、uv は No solution found when resolving dependencies を出して終了コード 1 で止まる。
uv 0.13.6 で requests==2.31.0 と urllib3<1.21 を同時に足すと、次の表示になった。

error: Failed to add dependencies
  cause: No solution found when resolving dependencies
  cause: Because requests==2.31.0 depends on urllib3>=1.21.1,<3 and your project depends on requests==2.31.0, we can conclude that your project depends on urllib3>=1.21.1,<3.
         And because your project depends on urllib3<1.21, we can conclude that your project's requirements are unsatisfiable.

2 行目の cause が、どの条件とどの条件がぶつかったかを順に説明している。
最後の文の your project depends on ... に出た指定を直すと解決する。
uv pip install で同じ衝突を起こした場合は、先頭が error: No solution found when resolving dependencies になり、you require ... という言い方で同じ説明が続いた。

実行例

python:3.12 の uv 0.13.7 で、存在しない版・ぶつかる条件・存在しない名前・広すぎる requires-python を試すと、どれも No solution found と終了コード 1 で止まった。
urllib3>=2 に緩めると、同じ uv add が終了コード 0 で通った。

$ uv --version
uv 0.13.7 (x86_64-unknown-linux-gnu)
$ uv add requests==99.0
Using CPython 3.12.16 interpreter at: /usr/local/bin/python3
Creating virtual environment at: .venv
error: Failed to add dependencies
  cause: No solution found when resolving dependencies
  cause: Because there is no version of requests==99.0 and your project depends on requests==99.0, we can conclude that your project's requirements are unsatisfiable.
 
hint: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing
$ echo $?
1
$ uv add requests==2.31.0 "urllib3<1.21"
error: Failed to add dependencies
  cause: No solution found when resolving dependencies
  cause: Because requests==2.31.0 depends on urllib3>=1.21.1,<3 and your project depends on requests==2.31.0, we can conclude that your project depends on urllib3>=1.21.1,<3.
         And because your project depends on urllib3<1.21, we can conclude that your project's requirements are unsatisfiable.
 
hint: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing
$ echo $?
1
$ uv add no-such-package-dekinai-demo
error: Failed to add dependencies
  cause: No solution found when resolving dependencies
  cause: Because no-such-package-dekinai-demo was not found in the package registry and your project depends on no-such-package-dekinai-demo, we can conclude that your project's requirements are unsatisfiable.
 
hint: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing
$ echo $?
1
$ uv add requests==2.31.0 "urllib3>=2"
Resolved 6 packages in 90ms
Prepared 5 packages in 144ms
Installed 5 packages in 4ms
 + certifi==2026.10.23
 + charset-normalizer==3.5.2
 + idna==3.20
 + requests==2.31.0
 + urllib3==2.8.0
$ echo $?
0
$ grep -A3 dependencies pyproject.toml
dependencies = [
    "requests==2.31.0",
    "urllib3>=2",
]
$ uv add "django>=5.2"
Using CPython 3.12.16 interpreter at: /usr/local/bin/python3
Creating virtual environment at: .venv
error: Failed to add dependencies
  cause: No solution found when resolving dependencies for split (markers: python_full_version >= '3.8' and python_full_version < '3.10')
  cause: Because the requested Python version (>=3.8) does not satisfy Python>=3.12 and django>=6.0a1 depends on Python>=3.12, we can conclude that django>=6.0a1 cannot be used. (1)
 
         Because the requested Python version (>=3.8) does not satisfy Python>=3.10 and django>=5.2,<=5.2.19 depends on Python>=3.10, we can conclude that django>=5.2,<=5.2.19 cannot be used.
         And because only the following versions of django are available:
             django<=5.2.19
             django>=6.0a1
         we can conclude that django>=5.2,<6.0a1 cannot be used.
         And because we know from (1) that django>=6.0a1 cannot be used, we can conclude that django>=5.2 cannot be used.
         And because your project depends on django>=5.2, 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`.
 
hint: The `requires-python` value (>=3.8) includes Python versions that are not supported by your dependencies (e.g., django>=6.0a1 only supports >=3.12). Consider using a more restrictive `requires-python` value (like >=3.12).
 
hint: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing
$ echo $?
1
$ grep requires-python pyproject.toml
requires-python = ">=3.10"

— 2026-11-07 時点の出力

検証環境Python 3.12.16 / Git 2.47.3 / uv 0.13.7 / 2026-11-07 検証
検証日
実行環境
python:3.12 Debian GNU/Linux 13 (trixie)
バージョン
  • Python 3.12.16
  • Git 2.47.3
  • uv 0.13.7

この記事の「実行例」は、上記の環境で実際にコマンドを実行して得られた出力をそのまま掲載しています。 再現手順はリポジトリの検証スクリプトとして管理し、定期的に再実行して出力を更新しています。

解決策

1. 版の指定を実在する範囲に直す

PyPI のパッケージのページで公開されている版を確かめ、pyproject.toml の指定を直してから uv lock をやり直す。

2. ぶつかっている条件の片方を緩める

cause の説明に出た 2 つの指定のうち、動かしてよいほうを変える。
urllib3 の指定を >=2 にすると、同じ uv add が通り urllib3==2.8.0 が入った。

uv add 'requests==2.31.0' 'urllib3>=2'

hint に出る --frozen はロックと同期を飛ばす指定なので、衝突そのものは残る。

3. requires-python の下限を上げる

requires-python = ">=3.8" のプロジェクトに uv add 'django>=5.2' を実行すると、Python 3.8〜3.9 の範囲で解決できずに止まった。
このとき hint は、依存が対応していない Python が範囲に入っていることを示し、より狭い値を勧める。

hint: The `requires-python` value (>=3.8) includes Python versions that are not supported by your dependencies (e.g., django>=6.0a1 only supports >=3.12). Consider using a more restrictive `requires-python` value (like >=3.12).
[project]
requires-python = ">=3.10"

下限を >=3.10 に上げると、同じコマンドが終了コード 0 で通った。
古い Python も支える必要があるなら、下限は動かさずに依存の版の範囲を古い側へ広げる。

4. 名前とインデックスを確かめる

綴りを直しても見つからず、社内のパッケージレジストリにだけあるパッケージなら、[[tool.uv.index]](新しいタブで開く) で name と url を書いて uv にインデックスを教える。

よくある原因

  1. 存在しない版を指定している。
    uv add 'requests==99.0' は there is no version of requests==99.0 と説明して止まった。
  2. 直接の依存どうしの条件がぶつかっている。
    上の例では、requests==2.31.0 が要求する urllib3>=1.21.1,<3 と、プロジェクトに書いた urllib3<1.21 が重ならない。
  3. requires-python の範囲が広すぎる。
    uv はロックファイルを requires-python の範囲全体で使えるように解決するので、手元の Python が 3.12 でも、下限の 3.8 で使える版が無ければ失敗する。
  4. パッケージ名の綴りが違う。
    存在しない名前は was not found in the package registry と説明された。