tflite-model-maker cannot be installed correctly for different reasons on different configurations
Hi @JohnFarl, thanks for reporting the issue, it is actively being worked on, please follow the progress on https://github.com/tensorflow/tensorflow/issues/60431 It seems some users have had success with downgrading to python 3.9 for now. Can you try to see if those workarounds will help unblock you for now? I can confirm that installing either the TfLite Model Maker or the MediaPipe one fails using Python v3.11.5 on a Mac M1 for multiple users in our company. @pkgoogle you guys keep saying in multiple GitHub issues that this is actively worked upon, but:

1. There are at least 5 active issues in this repository apart from this one, with even **twice** as many closed ones. At this point you should probably ask yourselves, if so many people report issues with the installation process, maybe there actually *is* an issue and thus the process should be improved and/or better documented?
<img width="1225" alt="image" src="https://github.com/tensorflow/tensorflow/assets/3236878/fc961a99-bd11-409b-a9d5-ac92701cc401">
2. Not even the "new kid on the block" MediaPipe works. If you guys keep releasing new software, even though the old one isn't working correctly, how will that help the community?

I'm sorry, but at this point, it's a very valid question if the project development is still active. Do you guys even test out if the tools work? Like, seriously. Get a fresh new laptop and try to install either of the 2 model makers following the official tutorial.
 I fully empathise with @bogdanzurac's frustration! Arm64-based Macs are not bleeding-edge hardware anymore, and the fact that this issue still persist is IMO pretty embarrassing for the team responsible for these tools.

I'll try to summarise the approaches I have tried and my findings, in the hope that someone (@pkgoogle perhaps?) might take appropriate actions or provide constructive hints for how to move this forward.

Installing with Python 3.11 on MacOs with Arm64 (native environment) fails on [`tflite-support`](https://pypi.org/project/tflite-support/0.4.4/#files)
```text
The conflict is caused by:
    tflite-model-maker 0.4.2 depends on tflite-support>=0.4.2
    tflite-model-maker 0.4.1 depends on tflite-support-nightly
    :
    : 
```

Latest version of `tflite-support` at time of writing (linked above) provides wheels for Linux/Arm64 and MacOs/x86_64, but not the combo MacOs/Arm64. Python 3.11 is not the issue in this case, ref list of wheels in link above.

- `tflite-support` is built using Bazel, with which I'm not familiar. I might spend some time later to understand Bazel and try to build `tflite-support` for MacOs/Arm64. Any constructive hints are greatly appreciated (not links to the manual - I'm able to find that myself 😉 )

Given that `tflite-support` is provided for MacOs/x86_64, it's tempting to lean on [Rosetta](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment) and install x86_64 versions of everything. However, scrolling a little down on the linked page reveals that AVX-instructions are not translated by Rosetta. Furthermore, [this issue](https://github.com/docker/for-mac/issues/6620) indicates that QEMU/Docker may not come to the rescue here either. Since Tensorflow [seems to rely heavily on AVX](https://saturncloud.io/blog/is-there-a-version-of-tensorflow-not-compiled-for-avx-instructions/) the approach of using x86_64 binaries seems to be unfruitful.

Last possibility I see on my M1 is to try wheels for Linux/Arm64 with some Arm64-based Linux like e.g. python:3.9-bullseye running in Docker:

```text
MacBook-Air:bjarne$ docker run -it --rm python:3.9-bullseye bash
root@9656157ee22e:/# arch
aarch64
root@9656157ee22e:/#
```

_(NOTE: The option `--use-deprecated=legacy-resolver` to pip is crucial in next step - wish the docs were clearer on this. See e.g. [this issue](https://github.com/tensorflow/tensorflow/issues/60431).)_

```text
root@ 9656157ee22e:/# pip install --use-deprecated=legacy-resolver tflite-model-maker
Collecting tflite-model-maker
  Downloading tflite_model_maker-0.4.2-py3-none-any.whl (577 kB) 
  : 
  : 
ERROR: Could not find a version that satisfies the requirement tensorflow-addons>=0.11.2 (from tflite-model-maker) (from versions: none)
ERROR: No matching distribution found for tensorflow-addons>=0.11.2 (from tflite-model-maker)
```
<br/>

Looking up [wheels for tensorflow-addons on pypi](https://pypi.org/project/tensorflow-addons/0.21.0/#files) we see that there is indeed no wheel for Linux/Arm64. Ironically, there **are** wheels for MacOs/Arm64... 🤦  Moreover, adding insult to injury, [tensorflow-addons will be discontinued](https://github.com/tensorflow/addons/issues/2807) in a year or so.

*sigh*


Installing [mediapipe-model-maker](https://pypi.org/project/mediapipe-model-maker/0.2.1.3/) (_aka "new kid on the block"_) on MacOs/Arm64 fails because [tensorflow-text==2.13.0](https://pypi.org/project/tensorflow-text/2.13.0/#files) has no wheel for the platform
<br/>

```text
MacBook-Air:bjarne$ pip install mediapipe-model-maker
  : 
  : 
ERROR: Cannot install mediapipe-model-maker because these package versions have conflicting dependencies.

The conflict is caused by:
    tf-models-official 2.13.2 depends on tensorflow-text~=2.13.0
  : 
  : 
```
<br/>

Installing the `mediapipe-model-maker` in Linux/Arm64 under Docker bumps into the problem with `tensorflow-addons`
<br/>

```text
root@9656157ee22e:/# pip install mediapipe-model-maker
Collecting mediapipe-model-maker
  Downloading mediapipe_model_maker-0.2.1.3-py3-none-any.whl (127 kB)
  : 
  : 
ERROR: Cannot install mediapipe-model-maker==0.1.0.2, mediapipe-model-maker==0.1.1.0, mediapipe-model-maker==0.1.1.1, mediapipe-model-maker==0.2.1, mediapipe-model-maker==0.2.1.1, mediapipe-model-maker==0.2.1.2 and mediapipe-model-maker==0.2.1.3 because these package versions have conflicting dependencies.

The conflict is caused by:
    mediapipe-model-maker 0.2.1.3 depends on tensorflow-addons
    mediapipe-model-maker 0.2.1.2 depends on tensorflow-addons
  : 
  : 
```
<br/>

Hence, on an Arm-based Mac trying to use `tflite-model-maker` I'm stuck until either

1. `tflite-support` provides wheel for MacOs/Arm64
2. `tensorflow-addons` provides wheel for Linux/Arm64 (requires QEMU/Docker)

and trying to use `mediapipe-model-maker` I'm stuck until either

1. `tensorflow-text==2.13.0` provides wheel for MacOs/Arm64
2. `tensorflow-addons` provides wheel for Linux/Arm64 (requires QEMU/Docker)

 The installation of the tflite-model-maker with the pip command keeps crashing on Google Colab.  Either due to requirements not being found, or the disk running out of space. As a result, cannot complete the Flower Classification tutorial. Hi @BjarneHerland, it is probably best to post those issues on the mediapipe github issues page: https://github.com/google/mediapipe/issues, I tried a couple of things it seems python=3.10 works best. I was able to install with python=3.10 successfully on linux x86_64. It might be worth it to try on linux ARM. Using colab is probably the most stable currently. I am running into a different issue for my mac M1. :

```sh
Collecting pyyaml<6.0,>=5.1 (from tf-models-official==2.11.6->mediapipe-model-maker)
  Using cached PyYAML-5.4.1.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [62 lines of output]
      /private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
      !!
      
              ********************************************************************************
              The license_file parameter is deprecated, use license_files instead.
      
              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************
      
      !!
        parsed = self.parsers.get(option_name, lambda x: x)(value)
      running egg_info
      writing lib3/PyYAML.egg-info/PKG-INFO
      writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
      writing top-level names to lib3/PyYAML.egg-info/top_level.txt
      Traceback (most recent call last):
        File "/Users/xxxxxx/miniforge3/envs/mediapipe_model_maker/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/xxxxxx/miniforge3/envs/mediapipe_model_maker/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Users/xxxxxxx/miniforge3/envs/mediapipe_model_maker/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 271, in <module>
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 318, in run
          self.find_sources()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 326, in find_sources
          mm.run()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 548, in run
          self.add_defaults()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/command/egg_info.py", line 586, in add_defaults
          sdist.add_defaults(self)
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/command/sdist.py", line 113, in add_defaults
          super().add_defaults()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
        File "<string>", line 201, in get_source_files
        File "/private/var/folders/q_/v3c1qs3n1z56cfpxr_5v3p1w0148zx/T/pip-build-env-ye44j30y/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
``` Thanks again for your involvement @pkgoogle! I'll consider a separate post in the right repo later.

IIRC, this pyyaml-issue you see can be resolved by installing the `pyyaml` binary package  via e.g. `conda` prior to running pip (looks like compiling pyyaml on Osx/Arm fails for some reason). Personally I use `miniforge` but other pkg-managers like `anaconda`, `mamba`, `poetry` etc might also work (just make sure to install an acceptable version)

> Hi @BjarneHerland, it is probably best to post those issues on the mediapipe github issues page: https://github.com/google/mediapipe/issues, I tried a couple of things it seems python=3.10 works best. I was able to install with python=3.10 successfully on linux x86_64. It might be worth it to try on linux ARM. Using colab is probably the most stable currently. I am running into a different issue for my mac M1. :
> 
> ```shell
> Collecting pyyaml<6.0,>=5.1 (from tf-models-official==2.11.6->mediapipe-model-maker)
>   Using cached PyYAML-5.4.1.tar.gz (175 kB)
>   Installing build dependencies ... done
>   Getting requirements to build wheel ... error
>   error: subprocess-exited-with-error
>
>  [snip]
>
> ```

 No worries, correct if I install pyyaml=5.4.1 manually, it reaches the same error you got on Mac M1:

```
 Using cached mediapipe_model_maker-0.1.0.1-py3-none-any.whl (7.2 MB)
Collecting tf-models-official>=2.10.1 (from mediapipe-model-maker)
  Downloading tf_models_official-2.13.0-py2.py3-none-any.whl.metadata (1.4 kB)
  Downloading tf_models_official-2.12.1-py2.py3-none-any.whl.metadata (1.5 kB)
  Downloading tf_models_official-2.12.0-py2.py3-none-any.whl (2.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.6/2.6 MB 27.0 MB/s eta 0:00:00
  Downloading tf_models_official-2.11.5-py2.py3-none-any.whl (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 29.8 MB/s eta 0:00:00
  Downloading tf_models_official-2.11.4-py2.py3-none-any.whl (2.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 19.9 MB/s eta 0:00:00
  Downloading tf_models_official-2.11.3-py2.py3-none-any.whl (2.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 21.8 MB/s eta 0:00:00
  Downloading tf_models_official-2.11.2-py2.py3-none-any.whl (2.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 36.4 MB/s eta 0:00:00
  Downloading tf_models_official-2.11.0-py2.py3-none-any.whl (2.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 32.7 MB/s eta 0:00:00
  Downloading tf_models_official-2.10.1-py2.py3-none-any.whl (2.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 39.1 MB/s eta 0:00:00
Collecting sacrebleu==2.2.0 (from tf-models-official>=2.10.1->mediapipe-model-maker)
  Downloading sacrebleu-2.2.0-py3-none-any.whl (116 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 116.6/116.6 kB 19.6 MB/s eta 0:00:00
Collecting mediapipe-model-maker
  Using cached mediapipe_model_maker-0.1.0-py3-none-any.whl (7.0 MB)
Collecting tf-models-official>=2.10 (from mediapipe-model-maker)
  Downloading tf_models_official-2.10.0-py2.py3-none-any.whl (2.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 40.4 MB/s eta 0:00:00
INFO: pip is still looking at multiple versions of mediapipe-model-maker to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install mediapipe-model-maker==0.1.0.2, mediapipe-model-maker==0.1.1.0 and mediapipe-model-maker==0.1.1.1 because these package versions have conflicting dependencies.

The conflict is caused by:
    mediapipe-model-maker 0.1.1.1 depends on mediapipe==0.9.2.1
    mediapipe-model-maker 0.1.1.0 depends on mediapipe==0.9.2.1
    mediapipe-model-maker 0.1.0.2 depends on mediapipe==0.9.0.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/topics/dependency-resolution/#dealing-with-dependency-conflicts
``` On the subject of `mediapipe-model-maker` [this reply](https://github.com/google/mediapipe/issues/4088#issuecomment-1832754598) points to an announcement from the Tensorflow Text team stating that wheels will be provided only for Linux x86_64 and Intel-based Macs (`mediapipe-model-maker` depends on `tensorflow-text` at present).

The recommended solution is to build wheels for the desired platform from source yourself.

Moreover, quoting from the [announcement](https://github.com/tensorflow/text/tree/b32645fbf1e4fd7e81d8d03fa2d2b4872e3a270d#a-note-about-different-operating-system-packages)

> Note that TF Text needs to be built in the same environment as TensorFlow. Thus, if you manually build TF Text, it is highly recommended that you also build TensorFlow.

 > On the subject of `mediapipe-model-maker` [this reply](https://github.com/google/mediapipe/issues/4088#issuecomment-1832754598) points to an announcement from the Tensorflow Text team stating that wheels will be provided only for Linux x86_64 and Intel-based Macs (`mediapipe-model-maker` depends on `tensorflow-text` at present).
> 
> The recommended solution is to build wheels for the desired platform from source yourself.
> 
> Moreover, quoting from the [announcement](https://github.com/tensorflow/text/tree/b32645fbf1e4fd7e81d8d03fa2d2b4872e3a270d#a-note-about-different-operating-system-packages)
> 
> > Note that TF Text needs to be built in the same environment as TensorFlow. Thus, if you manually build TF Text, it is highly recommended that you also build TensorFlow.

This is a ridiculous decision. Windows is the desktop OS with most market share and Mac is moving to arm. So the decision to stop support to anything other than Linux x86_64 and Intel-based Macs makes no sense. > On the subject of `mediapipe-model-maker` [this reply](https://github.com/google/mediapipe/issues/4088#issuecomment-1832754598) points to an announcement from the Tensorflow Text team stating that wheels will be provided only for Linux x86_64 and Intel-based Macs (`mediapipe-model-maker` depends on `tensorflow-text` at present).
> 
> The recommended solution is to build wheels for the desired platform from source yourself.

This opens up a can of worms for those with Apple M1 chips.  

Is there a proper Docker image or anything out there? I'm also trying to figure out how to install model-maker on m1 and it looks like docker is the only way..
@lucksp did u figure out the docker file? > I'm also trying to figure out how to install model-maker on m1 and it looks like docker is the only way.. @lucksp did u figure out the docker file?

I ended up using Google's Vertex AI to create my exportable TFLite models @lucksp is your use case an image classification? i believe its the only one you can export from Vertex tools. text classification is not supported, there is an old feature request: https://issuetracker.google.com/issues/168860629 yes, images.
If you try to install tflite-model-maker-nightly basically it starts to download **all nightly build wheels** since the first release rather than latest one as supposed.

This seems caused by a bad configuration.  Many people have reported this issue [many months ago](https://github.com/tensorflow/tensorflow/issues/60431), it remained unsolved as this [other issue](https://github.com/tensorflow/tensorflow/issues/61337).

But they aren't the only setup issues that affects tflite-model-maker.

If you try to install the latest build with `pip install tflite-model-maker` it raises various errors 
e.g.
tflite-support dependency that hasn't any wheel available in repository (for windows since the 0.4.0 released in May 2022 there is no wheel at all and the latest is 0.3.1 that has no wheel for latest Python versions).

Tried on Linux arm64 and needed wheels are missing too.
 
How is decided to upgrade version dependencies requirements without release updated dependencies coherently, considering these are developed by same company?

If it isn't followed a coherent path, it is obvious that troubles arise and you have to waste time trying to find if there is a combination of OS type, architecture, Python version, package version, dependency version, that may work, digging in the repository release history and requirements. 

tflite-model-maker has been released a couple of years ago to simplify model training and it was very good at this, before the project maintenance started to become erratic and lackluster creating a lot of compatibility issues and conflicts. 

Is this project development still active?