質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.31%
Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

1685閲覧

pythonのtensorflowをインストールしたいです

yomoanyan

総合スコア14

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

1グッド

0クリップ

投稿2023/11/14 14:42

編集2023/11/14 14:46

実現したいこと

pythonでtensorflowをインストールしたいです。
何がインストールできない原因なのかご意見いただきたいです。

必要な情報等ありましたら、言ってくださるとありがたいです。よろしくお願いいたします。

前提

OS : Mac OS version 11.7.4
python version : 3.10.5
pip version : 23.3.1
keras version : 2.15.0

発生している問題・エラーメッセージ

Collecting tensorflow Using cached tensorflow-2.14.0-cp310-cp310-macosx_10_15_x86_64.whl.metadata (3.9 kB) Collecting absl-py>=1.0.0 (from tensorflow) Using cached absl_py-2.0.0-py3-none-any.whl.metadata (2.3 kB) Collecting astunparse>=1.6.0 (from tensorflow) Using cached astunparse-1.6.3-py2.py3-none-any.whl (12 kB) Collecting flatbuffers>=23.5.26 (from tensorflow) Using cached flatbuffers-23.5.26-py2.py3-none-any.whl.metadata (850 bytes) Collecting gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 (from tensorflow) Using cached gast-0.5.4-py3-none-any.whl (19 kB) Collecting google-pasta>=0.1.1 (from tensorflow) Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB) Collecting h5py>=2.9.0 (from tensorflow) Using cached h5py-3.10.0-cp310-cp310-macosx_10_9_x86_64.whl.metadata (2.5 kB) Collecting libclang>=13.0.0 (from tensorflow) Using cached libclang-16.0.6-py2.py3-none-macosx_10_9_x86_64.whl.metadata (5.2 kB) Collecting ml-dtypes==0.2.0 (from tensorflow) Using cached ml_dtypes-0.2.0-cp310-cp310-macosx_10_9_universal2.whl.metadata (20 kB) Collecting numpy>=1.23.5 (from tensorflow) Using cached numpy-1.26.2-cp310-cp310-macosx_10_9_x86_64.whl.metadata (61 kB) Collecting opt-einsum>=2.3.2 (from tensorflow) Using cached opt_einsum-3.3.0-py3-none-any.whl (65 kB) Requirement already satisfied: packaging in ./.pyenv/versions/3.10.5/lib/python3.10/site-packages (from tensorflow) (21.3) Collecting protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 (from tensorflow) Using cached protobuf-4.25.0-cp37-abi3-macosx_10_9_universal2.whl.metadata (541 bytes) Requirement already satisfied: setuptools in ./.pyenv/versions/3.10.5/lib/python3.10/site-packages (from tensorflow) (58.1.0) Requirement already satisfied: six>=1.12.0 in ./.pyenv/versions/3.10.5/lib/python3.10/site-packages (from tensorflow) (1.16.0) Collecting termcolor>=1.1.0 (from tensorflow) Using cached termcolor-2.3.0-py3-none-any.whl (6.9 kB) Collecting typing-extensions>=3.6.6 (from tensorflow) Using cached typing_extensions-4.8.0-py3-none-any.whl.metadata (3.0 kB) Collecting wrapt<1.15,>=1.11.0 (from tensorflow) Using cached wrapt-1.14.1-cp310-cp310-macosx_10_9_x86_64.whl (35 kB) Collecting tensorflow-io-gcs-filesystem>=0.23.1 (from tensorflow) Using cached tensorflow_io_gcs_filesystem-0.34.0-cp310-cp310-macosx_10_14_x86_64.whl.metadata (14 kB) Collecting grpcio<2.0,>=1.24.3 (from tensorflow) Using cached grpcio-1.59.2.tar.gz (24.8 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [10 lines of output] Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/private/var/folders/md/0rrzbk_j7n71ft_6v9b_s2nm0000gn/T/pip-install-cwyu6oga/grpcio_414d29c50e284e1f9933ce1021ef6645/setup.py", line 95, in <module> import commands File "/private/var/folders/md/0rrzbk_j7n71ft_6v9b_s2nm0000gn/T/pip-install-cwyu6oga/grpcio_414d29c50e284e1f9933ce1021ef6645/src/python/grpcio/commands.py", line 31, in <module> import support File "/private/var/folders/md/0rrzbk_j7n71ft_6v9b_s2nm0000gn/T/pip-install-cwyu6oga/grpcio_414d29c50e284e1f9933ce1021ef6645/src/python/grpcio/support.py", line 111, in <module> errors.CompileError: diagnose_compile_error, AttributeError: module 'setuptools.errors' has no attribute 'CompileError' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.

該当のソースコード

Python

1pip install tensorflow

試したこと

調べたところpythonのバージョンが新し過ぎても問題という記載も見られたため、対応表を調べたところ次のサイトを見つけました。
https://tecsingularity.com/cuda/version-2/
しかし、自分のpythonのバージョンも対応していそうで原因はよくわかりません。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

KoteKote1571👍を押しています

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2023/11/14 15:44

AttributeError: module 'setuptools.errors' has no attribute 'CompileError' (略) note: This error originates from a subprocess, and is likely not a problem with pip. 要旨;pipの問題じゃなさそうだよ。(setuptoolsのエラーっぽいよ) という感じです。setuptoolsのバージョンを少し古くして試してください。 python3 -m pip install setuptools==59.5.0 https://stackoverflow.com/questions/70520120/attributeerror-module-setuptools-distutils-has-no-attribute-version --- TFはGPU(CUDA)あり版ですよね?たまーにCUDA周りの互換性でこけたりもした記憶が…
melian

2023/11/14 15:50

AttributeError: module 'setuptools.errors' has no attribute 'CompileError' と表示されていますので、setuptools をバージョンアップしてみてはどうでしょうか。 pip install -U setuptools
yomoanyan

2023/11/15 02:02

解決できました。ありがとうございます。
guest

回答1

0

自己解決

最初melian様のご意見の通りsetuptoolsのバージョンアップを行い、再度tensorflowのインストール行ったところインストールをすることはできました。

本件の内容とは異なりますが、それと同時に出されたエラーがあったため、今後自分と同じような方が出た時の参考にでもなればと思い追記します。
「pip依存のリゾルバがインストールされた全てのパッケージを考慮していない」というエラーとともにnumpyとscipyのバージョンが噛み合っていないというエラーが出たため、fourteenlength様のご意見をもとに、setuptoolsのバージョンを下げエラー分の通りnumpyとscipyのバージョンを変更したところ無事エラーがなくなりました。

以下、エラー内容

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. scipy 1.9.0 requires numpy<1.25.0,>=1.18.5, but you have numpy 1.25.0 which is incompatible.

御二方ご回答ありがとうございました。

投稿2023/11/15 02:10

yomoanyan

総合スコア14

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.31%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問