Issue in installing tflite-model-maker in Google Colab

This work around no longer works as its post mid May. Is there a fix for this?

Ya what to do about this Fallback runtine version is not available. So how to run it?

@ZeauZzz, @sobryan,

Sorry for the late response.

You can try to use the MediaPipe Model Maker

For more details, please refer to the Object detection model customization guide

Thank you!

Hello, is this a permanent solution? Or are you still working on the installation problem with tflite model maker? It would be nice if that would work again. Thank you for your answer.

@Christian_Arends,

Welcome to the Tensorflow Forum!

No, A new release of TFLite Model Maker is coming soon to fix the issue.

MediaPipe Model Maker is evolved from TFLite Model Maker and is the next generation on-device training tool.

Thank you!

Hello @chunduriv, running the example you provided for mediapipe model maker give me this error:

Traceback (most recent call last):
  File "c:/Users/froze/Desktop/poutses/kapota.py", line 1, in <module>
    from mediapipe_model_maker import object_detector
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mediapipe_model_maker\__init__.py", line 17, in <module>
    from mediapipe_model_maker.python.vision import image_classifier
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mediapipe_model_maker\python\vision\image_classifier\__init__.py", line 16, in <module>
    from mediapipe_model_maker.python.vision.image_classifier import dataset
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\mediapipe_model_maker\python\vision\image_classifier\dataset.py", line 21, in <module>
    import tensorflow_datasets as tfds
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\__init__.py", line 43, in <module>
    import tensorflow_datasets.core.logging as _tfds_logging
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\core\__init__.py", line 22, in <module>
    from tensorflow_datasets.core import community
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\core\community\__init__.py", line 18, in <module>
    from tensorflow_datasets.core.community.huggingface_wrapper import mock_builtin_to_use_gfile
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\core\community\huggingface_wrapper.py", line 31, in <module>
    from tensorflow_datasets.core import dataset_builder
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\core\dataset_builder.py", line 34, in <module>
    from tensorflow_datasets.core import dataset_info
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\core\dataset_info.py", line 47, in <module>
    from tensorflow_datasets.core import file_adapters
  File "C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\tensorflow_datasets\core\file_adapters.py", line 29, in <module>
    from array_record.python import array_record_module
ImportError: cannot import name 'array_record_module' from 'array_record.python' (C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\array_record\python\__init__.py)

I tried with multiple python versions

@Mihail,

Can you try with !pip install tensorflow-datasets==4.8.3 and let us know?

Thank you!

@chunduriv it now says

Traceback (most recent call last):
  File "c:\Users\froze\Desktop\poutses\kapota.py", line 1, in <module>
    from mediapipe_model_maker import object_detector
ImportError: cannot import name 'object_detector' from 'mediapipe_model_maker' (C:\Users\froze\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\mediapipe_model_maker\__init__.py)

I wonder if it is because im using tf-nightly. Im forced to use it cause the normal one doesnt detect my gpu

UPDATE: tested it with normal tf, error remains

@Mihail,

As this problem relates to mediapipe_model_maker, would you kindly create a new issue with the standalone code? so that it is easy to followup.

Thank you!

1 Like

@chunduriv opened here for future reference Error running mediapipe model maker

Is the installation issue of tflite-mode-maker in Google Colab is resolved? Please reply

@chunduriv solution no longer working

@iamthedankness, @Bijoy_Kumar_Upadhyay,

The issue still exists. You can try the workaround as suggested in 60431#issuecomment by @ tomkuzma

Even though you can make a conda environment in colab, it will still always use the colab runtime python version. But you can force it to use the environment by using a bash script and activate it every time you need to use it. Unfortunately this means that you can’t use cells for python code, but instead you can just have it run a python file with all the code you need to use.

I’ve got it working in this notebook. There was a few dependencies like numpy that needed a specific version installation, but after that it was working and training as you can see in the screenshot. Just make your own python file to run for training and you should be good to go.

Google Colab

Thank you!

1 Like

Is there any timeline when the fix will be coming?

When I use colab to run the image classification example, when I run to the command: !sudo apt -y install libportaudio2 !pip install -q tflite-model-maker, it took a long time to install dependent packages, and finally reported an error because of insufficient hard disk space, my hard disk has 107.7G, why is it not enough to install dependent packages, what should I do? Is it useful to upgrade colab pro?

It prompts that the disk space is insufficient, upgrade pro or delete files, what should I do?

1 Like

I upgraded to colab pro and tried to install tflite-model-maker, but still the same issue. It took forever to install, and then it showed insufficient disk space.
I tried to use fallback runtime version, but it is not available.
I’m doing my school assignment, will the issue be fixed anytime soon?
Or should I just use tensorflow instead to train my model?

If the installation of tflite-model-maker and tflite-support in Google Colab is causing issues and running indefinitely, consider troubleshooting by ensuring a stable internet connection.

Additionally, clear the Colab output cell to prevent log buildup that may slow down or stall the installation process. If the problem persists, you can try installing the packages on your local machine or another environment to see if the issue is specific to Colab.

Check for any recent updates or changes in the packages that might affect the installation process, and consult community forums or documentation for further assistance.

I really hope you guys are still working on this. This problem really sucks. I can’t train new models for my Vizy cam easily. I’m trying to figure out how to use the Mediapipe solution instead m, but I’m new to this and struggling. Any progress?

You can face the issue with the following method : Running Tflite Model Maker in Google Colab June/July 2023
Hope that it’ll help you.

Thank you. I’m working on figuring it out combining that with the Vizy cam training code. This is all new to me and I didn’t expect it to be broken. Vizy Cam basically said they can’t do anything, but there’s alway a work around. Thanks. :grinning: