3

I'm trying to build Tensorflow from source (if I install directly it works fine but I'm trying to get AVX2/FMA extensions support as I can't use CUDA/GPU) and I'm following this tutorial to build Tensorflow 1.15 (which is needed for the project that I use, I can't use 2.x).

I've built Tensorflow successfully, but when I try to install the wheel with pip I get the following error:

ERROR: tensorflow-1.15.5-cp37-cp37m-macosx_11_0_x86_64.whl is not a supported wheel on this platform.

Well, I know what the error means but the problem is that:

The wheel, as implied by the filename, is built for:

  • Python 3.7
  • macOS 11.0
  • x86/64

Which is already what I have (yup, double checked Python version, it's exactly Python 3.7.9, and no I'm not on M1 if that matters, I'm on Intel Mac). Why am I getting this error message even though I'm on the platform that the wheel is built for?

UPDATE: I'm already on the latest pip as of writing, and I can verify pip and python point to the same version:

(tf) can@can-mbp tensorflow % which pip 
/opt/anaconda3/envs/tf/bin/pip
(tf) can@can-mbp tensorflow % which python
/opt/anaconda3/envs/tf/bin/python
(tf) can@can-mbp tensorflow % pip -V
pip 21.0 from /opt/anaconda3/envs/tf/lib/python3.7/site-packages/pip (python 3.7)
(tf) can@can-mbp tensorflow % python -V
Python 3.7.9
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • Try upgrading your `pip` version. I believe older versions have a bug with newer versions of mac os – jordanm Jan 25 '21 at 16:20
  • @jordanm I'm already on the latest version, 21.0 as of writing. – Can Poyrazoğlu Jan 25 '21 at 16:23
  • How are you using `pip`? Are you using `pip install ` or `python -m pip `? And have you verified that the `pip` you are using is pointing to the python3.7 that you have indicated? – C.Nivs Jan 25 '21 at 16:25
  • 1
    @C.Nivs I've tried both ways, same error. I've also checked that they point to the same installation from the Anaconda environment that I'm in. see the updated question. – Can Poyrazoğlu Jan 25 '21 at 16:29
  • What does simply running the `python` command give you? As in `Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24)`, etc.. – Axe319 Jan 25 '21 at 16:51
  • @Axe319 it prints `Python 3.7.9 (default, Aug 31 2020, 07:22:35) [Clang 10.0.0 ] :: Anaconda, Inc. on darwin` – Can Poyrazoğlu Jan 25 '21 at 17:14
  • 1
    Possibly related to https://github.com/apple/tensorflow_macos/issues/46 ? There are some workarounds mentioned but I'm not on Mac so I can't test. – Axe319 Jan 25 '21 at 17:26
  • 1
    @Axe319 unbelievable. it worked. you can post this as an answer so i can accept it when available. – Can Poyrazoğlu Jan 25 '21 at 18:02
  • 1
    You can self answer when it's available to you if you want. I'm sure you can provide more details than I could since I don't actually use Mac. I just dug through the `pip` source a bit to see what would throw the error. – Axe319 Jan 25 '21 at 18:12

3 Answers3

5

FOR MACOS - BIG SUR

I was able to solve this problem when I found that the version of the macOS operating system does not match the version actually recognized by python

I'm using macOS 11.4, the file is with this version. But when typing a command in the terminal, I found that python recognizes 11.0.

python3
from distutils import util
util.get_platform()
>> 'macosx-11.0-arm64'

generated file name:

opencv_python-4.5.2+2344814-cp39-cp39-macosx_11_4_arm64.whl

new file name:

opencv_python-4.5.2+2344814-cp39-cp39-macosx_11_0_arm64.whl

Bruno Brant
  • 8,226
  • 7
  • 45
  • 90
luisdemarchi
  • 1,402
  • 19
  • 29
3

Upon @Axe319's comment I took a look at https://github.com/apple/tensorflow_macos/issues/46 and seen that simply changing the wheel's filename's OS section to 10_9 works. There is probably a bug with parsing macOS 11.0 or Python doesn't think it supports 11.0 (maybe that particular Python/pip version was before Big Sur was released).

Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
0

Make sure the Python version you are using (32/64 bit) does match what the wheel requires ;)

Rik Schoonbeek
  • 3,908
  • 2
  • 25
  • 43