Closed1

【Mac】tensorflowをインストールできない「Could not find a version that satisfies the requirement tensorflow」

おっくソおっくソ

https://zenn.dev/okkuso/scraps/5ae326be49a1fe

↑の続きで、tensorflowをいよいよインストールしていきます。

@ITの記事通りにコマンドを打っていきます。

https://www.atmarkit.co.jp/ait/articles/1804/19/news136.html

僕はふつうのMacBook Proを使っているのでハイスペックGPUを積んでいるわけではないです。(たぶん)

なのでCPU版のtensorflowをインストール。
(「introtensorflow4」という名前の仮想環境です)

pip --no-cache-dir install -I -U tensorflow

するとエラーが出ました。

(introtensorflow4) MacBook-Pro:~ username$ pip --no-cache-dir install -I -U tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow
ERROR: No matching distribution found for tensorflow

謎ですね。

調べてみると↓のような記事がありました。

https://sukota.hatenablog.com/entry/2018/10/24/160521

tensorflowをURLからインストールしたら成功するかも、ということでtensorflowのサイトを確認。

https://www.tensorflow.org/install/pip?hl=ja

確認するとPythonのバージョンによって、パッケージのURLが異なっていますが、とりあえず1番新しい3.8のものを使ってインストールを試みてみます。

(introtensorflow4) MacBook-Pro:~ username$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.4.0-cp38-cp38-manylinux2010_x86_64.whl
ERROR: tensorflow_cpu-2.4.0-cp38-cp38-manylinux2010_x86_64.whl is not a supported wheel on this platform.

ダメですね。

ここで仮想環境内で使っているPythonのバージョンを確認。

(introtensorflow4) MacBook-Pro:~ username$ python --version
Python 3.9.1

バージョン違いでダメだったのかなと思いきや、3.9用のURLは載っていない。

じゃあPythonのバージョンを下げよう、ということで3.8に変更します。

(introtensorflow4) MacBook-Pro:~ username$ conda install python=3.8

(いろいろ再インストールされました)

そしてURLを使ったインストールを再トライ。

(introtensorflow4) MacBook-Pro:~ username$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.4.0-cp38-cp38-manylinux2010_x86_64.whl
ERROR: tensorflow_cpu-2.4.0-cp38-cp38-manylinux2010_x86_64.whl is not a supported wheel on this platform.

ダメでした。

バージョンを3.8に合わせたのに。

そこで@ITの記事にあった元々試していたコマンドを打ってみると、なぜか成功。

(introtensorflow4) MacBook-Pro:~ username$ pip --no-cache-dir install -I -U tensorflow
Collecting tensorflow
  Downloading tensorflow-2.4.1-cp38-cp38-macosx_10_11_x86_64.whl (173.9 MB)
     |████████████████████████████████| 173.9 MB 49.6 MB/s 
Collecting gast==0.3.3
  Downloading gast-0.3.3-py2.py3-none-any.whl (9.7 kB)
Collecting absl-py~=0.10
  Downloading absl_py-0.11.0-py3-none-any.whl (127 kB)
     |████████████████████████████████| 127 kB 67.7 MB/s 
Collecting astunparse~=1.6.3
  Downloading astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting flatbuffers~=1.12.0
  Downloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)
Collecting google-pasta~=0.2
  Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 52.5 MB/s 
Collecting grpcio~=1.32.0
  Downloading grpcio-1.32.0-cp38-cp38-macosx_10_9_x86_64.whl (3.3 MB)
     |████████████████████████████████| 3.3 MB 55.1 MB/s 
Collecting h5py~=2.10.0
  Downloading h5py-2.10.0-cp38-cp38-macosx_10_9_x86_64.whl (3.0 MB)
     |████████████████████████████████| 3.0 MB 46.9 MB/s 
Collecting keras-preprocessing~=1.1.2
  Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 36.5 MB/s 
Collecting numpy~=1.19.2
  Downloading numpy-1.19.5-cp38-cp38-macosx_10_9_x86_64.whl (15.6 MB)
     |████████████████████████████████| 15.6 MB 70.9 MB/s 
Collecting opt-einsum~=3.3.0
  Downloading opt_einsum-3.3.0-py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 51.0 MB/s 
Collecting protobuf>=3.9.2
  Downloading protobuf-3.14.0-cp38-cp38-macosx_10_9_x86_64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 48.7 MB/s 
Collecting six~=1.15.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting tensorboard~=2.4
  Downloading tensorboard-2.4.1-py3-none-any.whl (10.6 MB)
     |████████████████████████████████| 10.6 MB 56.0 MB/s 
Collecting google-auth<2,>=1.6.3
  Downloading google_auth-1.24.0-py2.py3-none-any.whl (114 kB)
     |████████████████████████████████| 114 kB 35.7 MB/s 
Collecting cachetools<5.0,>=2.0.0
  Downloading cachetools-4.2.1-py3-none-any.whl (12 kB)
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading google_auth_oauthlib-0.4.2-py2.py3-none-any.whl (18 kB)
Collecting markdown>=2.6.8
  Downloading Markdown-3.3.3-py3-none-any.whl (96 kB)
     |████████████████████████████████| 96 kB 65.0 MB/s 
Collecting pyasn1-modules>=0.2.1
  Downloading pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 64.9 MB/s 
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     |████████████████████████████████| 77 kB 43.0 MB/s 
Collecting requests<3,>=2.21.0
  Downloading requests-2.25.1-py2.py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 43.2 MB/s 
Collecting certifi>=2017.4.17
  Downloading certifi-2020.12.5-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 64.3 MB/s 
Collecting chardet<5,>=3.0.2
  Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)
     |████████████████████████████████| 178 kB 47.1 MB/s 
Collecting idna<3,>=2.5
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 57.3 MB/s 
Collecting requests-oauthlib>=0.7.0
  Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting oauthlib>=3.0.0
  Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 75.6 MB/s 
Collecting rsa<5,>=3.1.4
  Downloading rsa-4.7-py3-none-any.whl (34 kB)
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading tensorboard_plugin_wit-1.8.0-py3-none-any.whl (781 kB)
     |████████████████████████████████| 781 kB 65.6 MB/s 
Collecting tensorflow-estimator<2.5.0,>=2.4.0
  Downloading tensorflow_estimator-2.4.0-py2.py3-none-any.whl (462 kB)
     |████████████████████████████████| 462 kB 35.4 MB/s 
Collecting termcolor~=1.1.0
  Downloading termcolor-1.1.0.tar.gz (3.9 kB)
Collecting typing-extensions~=3.7.4
  Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.3-py2.py3-none-any.whl (137 kB)
     |████████████████████████████████| 137 kB 45.0 MB/s 
Collecting werkzeug>=0.11.15
  Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
     |████████████████████████████████| 298 kB 65.6 MB/s 
Collecting wheel~=0.35
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting wrapt~=1.12.1
  Downloading wrapt-1.12.1.tar.gz (27 kB)
Collecting setuptools>=41.0.0
  Downloading setuptools-52.0.0-py3-none-any.whl (784 kB)
     |████████████████████████████████| 784 kB 62.3 MB/s 
Building wheels for collected packages: termcolor, wrapt
  Building wheel for termcolor (setup.py) ... done
  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4829 sha256=885981aecb6f69809df9a2dcd734729df5345e9c57b6dcaf87646bd96ae7f934
  Stored in directory: /private/var/folders/c3/fqj42bds4133l87v_07yff0m0000gn/T/pip-ephem-wheel-cache-p7xqh89l/wheels/a0/16/9c/5473df82468f958445479c59e784896fa24f4a5fc024b0f501
  Building wheel for wrapt (setup.py) ... done
  Created wheel for wrapt: filename=wrapt-1.12.1-cp38-cp38-macosx_10_9_x86_64.whl size=32641 sha256=b108bacf13f525d912c43b7aeaf3d9d47a6fbacef80ab06d1a500e1d1e640318
  Stored in directory: /private/var/folders/c3/fqj42bds4133l87v_07yff0m0000gn/T/pip-ephem-wheel-cache-p7xqh89l/wheels/5f/fd/9e/b6cf5890494cb8ef0b5eaff72e5d55a70fb56316007d6dfe73
Successfully built termcolor wrapt
Installing collected packages: urllib3, pyasn1, idna, chardet, certifi, six, setuptools, rsa, requests, pyasn1-modules, oauthlib, cachetools, requests-oauthlib, google-auth, wheel, werkzeug, tensorboard-plugin-wit, protobuf, numpy, markdown, grpcio, google-auth-oauthlib, absl-py, wrapt, typing-extensions, termcolor, tensorflow-estimator, tensorboard, opt-einsum, keras-preprocessing, h5py, google-pasta, gast, flatbuffers, astunparse, tensorflow
Successfully installed absl-py-0.11.0 astunparse-1.6.3 cachetools-4.2.1 certifi-2020.12.5 chardet-4.0.0 flatbuffers-1.12 gast-0.3.3 google-auth-1.24.0 google-auth-oauthlib-0.4.2 google-pasta-0.2.0 grpcio-1.32.0 h5py-2.10.0 idna-2.10 keras-preprocessing-1.1.2 markdown-3.3.3 numpy-1.19.5 oauthlib-3.1.0 opt-einsum-3.3.0 protobuf-3.14.0 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-2.25.1 requests-oauthlib-1.3.0 rsa-4.7 setuptools-52.0.0.post20210125 six-1.15.0 tensorboard-2.4.1 tensorboard-plugin-wit-1.8.0 tensorflow-2.4.1 tensorflow-estimator-2.4.0 termcolor-1.1.0 typing-extensions-3.7.4.3 urllib3-1.26.3 werkzeug-1.0.1 wheel-0.36.2 wrapt-1.12.1

とりあえず先へ進めます。

このスクラップは2021/01/31にクローズされました