io icon indicating copy to clipboard operation
io copied to clipboard

Cannot install Tensorflow.io on Mac M1

Open sconiac opened this issue 3 years ago • 83 comments

Hi Im trying to use Tensorflow.io while im learning object detection with this tutorial: https://www.youtube.com/watch?v=yqkISICHH-U&t=9352s and while im training my model I noticed an import of Tensorflow.io but I cannot install it. I try "pip install tenorflow.io" but I get error like: ERROR: Could not find a version that satisfies the requirement tensorflow.io (from versions: none) ERROR: No matching distribution found for tensorflow.io

sconiac avatar Feb 06 '22 20:02 sconiac

I am having the same issue. Did you found something related to this?

ZaibanAli avatar Feb 13 '22 20:02 ZaibanAli

you can install using pip install tensorflow-io. However, please note that the following are different:

import tensorflow as tf
# use tf.io.gfile.listdir(...)
import tensorflow_io as tfio
# use tfio.IODataset.from_audio(...)

The tfio wheels are yet to be built and released for M1 macs though.

kvignesh1420 avatar Feb 13 '22 20:02 kvignesh1420

After running pip install tensorflow-io I get this error:

ERROR: Could not find a version that satisfies the requirement tensorflow-io (from versions: none)
ERROR: No matching distribution found for tensorflow-io

ZaibanAli avatar Feb 13 '22 20:02 ZaibanAli

@ZaibanAli Since GitHub actions don't support M1 mac based runner environments, we couldn't auto build and publish the tensorflow-io wheels to PyPI for M1 devices. We are working on alternatives to add the support!

kvignesh1420 avatar Feb 13 '22 20:02 kvignesh1420

I tried to build io myself using python3 setup.py -q bdist_wheel but it gave me this error.

Project: tensorflow-io
Exclude: ['tests', 'tests.*', 'tensorflow_io_gcs_filesystem', 'tensorflow_io_gcs_filesystem.*']
Install Requires: ['tensorflow-io-gcs-filesystem==0.24.0']
Project Rootpath: tensorflow_io
Traceback (most recent call last):
  File "setup.py", line 138, in <module>
    setuptools.setup(
  File "/Users/zaiban.ali/miniforge3/envs/test0/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/Users/zaiban.ali/miniforge3/envs/test0/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Users/zaiban.ali/miniforge3/envs/test0/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/Users/zaiban.ali/miniforge3/envs/test0/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/zaiban.ali/miniforge3/envs/test0/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 328, in run
    impl_tag, abi_tag, plat_tag = self.get_tag()
  File "/Users/zaiban.ali/miniforge3/envs/test0/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 278, in get_tag
    assert tag in supported_tags, "would build wheel with unsupported tag {}".format(tag)
AssertionError: would build wheel with unsupported tag ('cp38', 'cp38', 'macosx_11_0_arm64')

Reference: https://github.com/tensorflow/io/issues/1298#issuecomment-774511436

ZaibanAli avatar Feb 13 '22 20:02 ZaibanAli

I think a similar result was posted in https://github.com/tensorflow/io/issues/1298#issuecomment-1019636662. It would be great to continue the discussion over there as I currently don't have an M1 mac to try things out.

kvignesh1420 avatar Feb 13 '22 20:02 kvignesh1420

Hi @kvignesh1420 , I have same issue, I can't install tensorflow-io on Mac m1. Till now, I am only able to install tensorflow-macos and tensorflow-metal successfully. Do you have any update or clue on the issue ? Is it possible to build the tensorflow-io source code from my machine Mac m1 ? If yes which tensorflow-io version I have to take ?

Here the version of tensorflow-deps installed in my machine.

tensorboard 2.8.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.1 tensorflow-macos 2.8.0 tensorflow-metal 0.3.0

We really appreciate your help. Many thanks.

aelmrabe avatar Feb 14 '22 17:02 aelmrabe

same issues

loyio avatar Feb 19 '22 09:02 loyio

same issue

invoxiaehu avatar Feb 21 '22 13:02 invoxiaehu

Ive fix it somehow, i think using wheel help. and then i need to manually change in files downloaded from the tutorial: tensorflow.io to tensorflow-io. It works for me but i'm not sure how exactly i fix it 😄

sconiac avatar Feb 21 '22 23:02 sconiac

@sconiac can you please tell us in more detail how you did it? I am stuck with this for more than 2 weeks.

ZaibanAli avatar Feb 21 '22 23:02 ZaibanAli

I remove my old project, so I create new one by following this tutorial: https://developer.apple.com/metal/tensorflow-plugin/. Then I type: $ git clone https://github.com/tensorflow/io.git $ cd io $ python3 setup.py -q bdist_wheel Project: tensorflow-io Exclude: ['tests', 'tests.*', 'tensorflow_io_gcs_filesystem', 'tensorflow_io_gcs_filesystem.*'] Install Requires: ['tensorflow-io-gcs-filesystem==0.24.0'] Project Rootpath: tensorflow_io /Users/olivierskonieczny/miniforge3/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( (There I get a warning but importing at the end work (also with some weird warnings :) ))

$ python3 -m pip install --no-deps dist/tensorflow_io-0.24.0-cp39-cp39-macosx_11_0_arm64.whl

And last I check if every thing works by: $ python3 >>> import tensorflow_io as tfio (its part that throw some error ) >>> print(tfio.__version__) 0.24.0

Hope all works,

sconiac avatar Feb 22 '22 20:02 sconiac

@sconiac thank you for explaining what you did. I already reached this point but the part where it throws a dynamic library error is the critical one and it is required by Tensorflow object detection api.

ZaibanAli avatar Feb 22 '22 21:02 ZaibanAli

Oh, sorry. I didn't notice that, but I'm afraid I don't know how to fix your issue. On my Mac every think works fine, even training my own model. I think you can try old fixing method just reinstall everything you can and that may help.

sconiac avatar Feb 22 '22 22:02 sconiac

Seems like @sconiac steps only works for MacOS 11 not for macOS 12 (Monterey)

dvaldivia avatar Mar 10 '22 06:03 dvaldivia

same issue

dusskapark avatar Mar 22 '22 02:03 dusskapark

also got the same issue

AntonMaj avatar Mar 23 '22 20:03 AntonMaj

Came here to say, same issue :-)

lhayhurst avatar Mar 24 '22 13:03 lhayhurst

Same issue aswell

wadinj avatar Mar 28 '22 21:03 wadinj

same issue as well

natehust avatar Mar 29 '22 01:03 natehust

same issue : )

JunZhan2000 avatar Apr 06 '22 00:04 JunZhan2000

Same issue, macOS 12 specifically.

gabijazdan avatar Apr 07 '22 11:04 gabijazdan

Same on Mac OS 12 Monterey, with this error:

SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.

Any news about compatibility with Apple Silicon please ?

GeoffreyBrunet avatar Apr 15 '22 09:04 GeoffreyBrunet

Same issue (macosx12 m1):

AssertionError: would build wheel with unsupported tag ('cp39', 'cp39', 'macosx_11_0_arm64')

doncarlos999 avatar Apr 21 '22 14:04 doncarlos999

Same issue on M1 Pro

maxmacstn avatar Apr 28 '22 13:04 maxmacstn

I recently updated my mac to OS 12.3.1 (M1), I am also facing same issue on installing tensorflow-io. kindly share any, if it can be fixed.

sriramk146 avatar May 02 '22 06:05 sriramk146

Same issue as well

giacomomiolo avatar May 08 '22 15:05 giacomomiolo

I am also facing the same issue on MacOS 12.3.1, on an M1 Pro 2021 MacBook Pro!

alexpotv avatar May 13 '22 22:05 alexpotv

Same problem here!

elia-secchi avatar May 16 '22 17:05 elia-secchi

Putting this here in case anybody else runs into the same issue I had with using conda. I finally got this working by ignoring the instructions here. And doing the following:

cd 
python3 -m venv .tensorflow
source ~/.tensorflow/bin/activate
brew install hdf5
export CPATH="/opt/homebrew/include/"
export HDF5_DIR=/opt/homebrew/
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
git clone https://github.com/tensorflow/io.git
cd io
python setup.py -q bdist_wheel --project tensorflow_io_gcs_filesystem
pip install --no-deps dist/tensorflow_io_gcs_filesystem-0.25.0-cp39-cp39-macosx_12_0_arm64.whl
python setup.py -q bdist_wheel
pip install --no-deps dist/tensorflow_io-0.25.0-cp39-cp39-macosx_12_0_arm64.whl

There may be other system requirements that need to be installed through brew that I already had installed. YMMV.

doncarlos999 avatar May 17 '22 08:05 doncarlos999