tensorflowはPython3.7と互換性がなくインストールできない。

スポンサーリンク

tensorflowはPython3.7と互換性がなく、インストールできないことについて解説します。

■Python

今回のPythonのバージョンは、「3.7.9」を使用しています。(Windows10)(pythonランチャーでの確認)

■tensorflowをインストールする

tensorflowをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install tensorflow

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.7.9にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.7 -m pip install tensorflow

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

Enterキーを押すと、メッセージとErrorが出力されました。これらの文を訳すと、「通常のサイトパッケージが書き込みできないため、ユーザーインストールにデフォルト設定される」や「tensorflowの要件を満たすバージョンが見つかりませんでした」といった内容です。

imagededupというライブラリでは、tensorflowを使用するのだが、このライブラリをインストールする際も、下記のErrorが出力されて、インストールできなかった。

ERROR: Cannot install imagededup==0.0.1, imagededup==0.0.2, imagededup==0.0.3, imagededup==0.0.4, imagededup==0.1.0, imagededup==0.2.1 and imagededup==0.2.2 because these package versions have conflicting dependencies.

The conflict is caused by:
imagededup 0.2.2 depends on tensorflow>1.0
imagededup 0.2.1 depends on tensorflow>1.0
imagededup 0.1.0 depends on tensorflow==2.0.0
imagededup 0.0.4 depends on tensorflow==2.0.0
imagededup 0.0.3 depends on tensorflow==1.13.1
imagededup 0.0.2 depends on tensorflow==1.13.1
imagededup 0.0.1 depends on tensorflow==1.13.1

To fix this you could try to:
1. loosen the range of package versions you’ve specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

tensorflowをインストールするために、試行錯誤を行いましたが、結局インストールできない。調べてみると、「Tensorflow not Compatible with Python 3.7(TensorflowはPython3.7と互換性がありません)(https://github.com/tensorflow/tensorflow/issues/23052)」というページがヒットしました。このページ内で「Tensorflow is not compatible with Python 3.7 for now because it depends on a version of protobuf which does not support Python 3.7.(Tensorflowは、Python 3.7をサポートしていないprotobufのバージョンに依存しているため、今のところPython 3.7との互換性はありません。)」という投稿がされていました。このことから、Tensorflowは、Python 3.7との互換性がなく、インストールできないという結論に至りました。当方の解決方法としては、Python3.7にダウングレードする。

コメント

タイトルとURLをコピーしました