Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install tflite-model-maker from pip or github #59855

Open
MartinKlefas opened this issue Mar 1, 2023 · 21 comments
Open

Can't install tflite-model-maker from pip or github #59855

MartinKlefas opened this issue Mar 1, 2023 · 21 comments
Assignees
Labels
comp:lite TF Lite related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:windows Windows Build/Installation Issues TF 2.11 Issues related to TF 2.11 TFLiteModelMaker TFLite Model Maker related issues type:bug Bug type:build/install Build and install issues

Comments

@MartinKlefas
Copy link

MartinKlefas commented Mar 1, 2023

Click to expand!

Issue Type

Bug

Have you reproduced the bug with TF nightly?

Yes

Source

source

Tensorflow Version

2.11

Custom Code

Yes

OS Platform and Distribution

Windows 10 home 19045

Mobile device

No response

Python version

3.10.9

Bazel version

No response

GCC/Compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current Behaviour?

pip install tfl-model-maker tries to install over 500 nightly builds, and then fails when it installs the sixth version of sentencepiece

I tried:

git clone https://github.com/tensorflow/examples
cd examples/tensorflow_examples/lite/model_maker/pip_package
pip install -e .

but this fails with: 
ERROR: Could not find a version that satisfies the requirement tflite-support>=0.4.2 (from tflite-model-maker) (from versions: 0.1.0a0.dev3, 0.1.0a0.dev4, 0.1.0a0.dev5, 0.1.0a0, 0.1.0a1)
ERROR: No matching distribution found for tflite-support>=0.4.2

This is all on a clean anaconda environment - the pip command is the first I've run in it.

There's a copy of the pip output online here: https://1drv.ms/t/s!AjAaK-BVbphXlhwIM_9IpsnL0y8z?e=49lK1J

Standalone code to reproduce the issue

pip install tflite-model-maker

Relevant log output

No response

@google-ml-butler google-ml-butler bot added the type:bug Bug label Mar 1, 2023
@tiruk007 tiruk007 added type:build/install Build and install issues subtype:windows Windows Build/Installation Issues TF 2.11 Issues related to TF 2.11 labels Mar 2, 2023
@tiruk007
Copy link
Contributor

tiruk007 commented Mar 7, 2023

@MartinKlefas
Sorry for the late reply. Could you please try to install using pip install tflite-model-maker with python 3.8. I was able to install the tflite-model-maker with python 3.8. Please refer to the below screenshot:
Screenshot (124)
Screenshot (125)
And also please refer to the similar issue and let us know if it helps.

Thank you!

@tiruk007 tiruk007 added the stat:awaiting response Status - Awaiting response from author label Mar 7, 2023
@MartinKlefas
Copy link
Author

MartinKlefas commented Mar 7, 2023

Thanks for the suggestion, this time it got a lot further than usual, and didn't download all the nightly builds, but I did still end up with the below error:
`
INFO: pip is looking at multiple versions of dm-tree to determine which version is compatible with other requirements. This could take a while.
Collecting dm-tree
Downloading dm_tree-0.1.7-cp38-cp38-win_amd64.whl (91 kB)
---------------------------------------- 91.0/91.0 kB ? eta 0:00:00
Downloading dm_tree-0.1.6-cp38-cp38-win_amd64.whl (75 kB)
---------------------------------------- 75.1/75.1 kB 4.1 MB/s eta 0:00:00
Downloading dm_tree-0.1.5-cp38-cp38-win_amd64.whl (83 kB)
---------------------------------------- 84.0/84.0 kB ? eta 0:00:00
INFO: pip is looking at multiple versions of etils[enp,epath] to determine which version is compatible with other requirements. This could take a while.
Downloading dm-tree-0.1.4.tar.gz (33 kB)
Preparing metadata (setup.py) ... done
Downloading dm-tree-0.1.2.tar.gz (31 kB)
Preparing metadata (setup.py) ... done
Downloading dm-tree-0.1.1.tar.gz (30 kB)
Preparing metadata (setup.py) ... done
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
INFO: pip is looking at multiple versions of decorator to determine which version is compatible with other requirements. This could take a while.
Collecting decorator>=3.0.0
Downloading decorator-5.1.0-py3-none-any.whl (9.1 kB)
INFO: pip is looking at multiple versions of dm-tree to determine which version is compatible with other requirements. This could take a while.
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
Downloading decorator-5.0.9-py3-none-any.whl (8.9 kB)
Downloading decorator-5.0.8-py3-none-any.whl (8.9 kB)
Downloading decorator-5.0.7-py3-none-any.whl (8.8 kB)
Downloading decorator-5.0.6-py3-none-any.whl (8.8 kB)
Downloading decorator-5.0.5-py3-none-any.whl (8.8 kB)
Downloading decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
INFO: pip is looking at multiple versions of decorator to determine which version is compatible with other requirements. This could take a while.
Downloading decorator-4.4.1-py2.py3-none-any.whl (9.2 kB)
Downloading decorator-4.4.0-py2.py3-none-any.whl (8.3 kB)
Downloading decorator-4.3.2-py2.py3-none-any.whl (9.1 kB)
Downloading decorator-4.3.1-py2.py3-none-any.whl (8.8 kB)
Downloading decorator-4.3.0-py2.py3-none-any.whl (9.2 kB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. See https://pip.pypa.io/warnings/backtracking for guidance. If you want to abort this run, press Ctrl + C.
Downloading decorator-4.2.1-py2.py3-none-any.whl (9.3 kB)
Downloading decorator-4.1.2-py2.py3-none-any.whl (9.1 kB)
Downloading decorator-4.1.1-py2.py3-none-any.whl (9.0 kB)
Downloading decorator-4.1.0-py2.py3-none-any.whl (9.0 kB)
Downloading decorator-4.0.11-py2.py3-none-any.whl (8.9 kB)
Downloading decorator-4.0.10-py2.py3-none-any.whl (9.2 kB)
Downloading decorator-4.0.9-py2.py3-none-any.whl (22 kB)
Downloading decorator-4.0.6-py2.py3-none-any.whl (21 kB)
Downloading decorator-4.0.4-py2.py3-none-any.whl (8.7 kB)
Downloading decorator-4.0.3-py2.py3-none-any.whl (8.5 kB)
Downloading decorator-4.0.2-py2.py3-none-any.whl (8.5 kB)
Downloading decorator-4.0.1-py2.py3-none-any.whl (8.5 kB)
Downloading decorator-4.0.0-py2.py3-none-any.whl (8.6 kB)
Downloading decorator-3.4.2.tar.gz (6.1 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in decorator setup command: use_2to3 is invalid.
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

`

Full install log is here: https://1drv.ms/t/s!AjAaK-BVbphXliztpWTdIGmr3Kf3?e=O5nb8I

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Mar 7, 2023
@MartinKlefas
Copy link
Author

If I follow the suggestion in the other issue and install with --no-dependencies then pip complains about missing dependencies next time I need a package, and the example code won't run.

I'm using the same code on a docker though that came with pre-installed tflite model maker - so I know it's this conda environment, and not the code that's the problem.

@tiruk007 tiruk007 assigned SuryanarayanaY and unassigned tiruk007 Mar 10, 2023
@pjpratik pjpratik assigned pjpratik and unassigned SuryanarayanaY Mar 13, 2023
@pjpratik pjpratik assigned sachinprasadhs and unassigned pjpratik Mar 31, 2023
@sachinprasadhs
Copy link
Contributor

Hi, I was able to install tflite_model-maker and tflite-model-maker-nightly using pip without any errors.
Please find the gist attached here for reference. Thanks!

@sachinprasadhs sachinprasadhs added stat:awaiting response Status - Awaiting response from author comp:lite TF Lite related issues labels Apr 4, 2023
@MartinKlefas
Copy link
Author

Thanks for the update. In almost all your pip lines it states: Requirement already satisfied
My install still failed from a completely clean conda environment though. Pip still could not work out which of the various dependent packages to use. Maybe it's because I'm on windows or something??

Please see attached the full log below - far too much to paste into this box, but suffice to say it's a fail.
tflite model maker install.txt

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Apr 5, 2023
@sachinprasadhs
Copy link
Contributor

I'm getting requirement already satisfied because I ran the tflite_model-maker in same session before trying nightly.

To understand more about the issue, could you please create a new conda environment using conda create -n venv_name
and install pip using conda install pip and try again installing pip install tflite_model-maker

@sachinprasadhs sachinprasadhs added the stat:awaiting response Status - Awaiting response from author label Apr 5, 2023
@MartinKlefas
Copy link
Author

OK, doing that will result in the even worse errors of my first post, because it'll be python 3.11.2 that gets used. It'll take an hour or so to fail, and will download hundreds of tf_models_nightly packages with dates at the end of their names. I'll post back the results shortly.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Apr 5, 2023
@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Apr 10, 2023
@terryheo terryheo assigned lu-wang-g and unassigned terryheo Apr 10, 2023
@MartinKlefas
Copy link
Author

I was wrong, it took a little under an hour, and output 1382 lines before hitting an error. As mentioned though, when not specifying a lower version of Python it tries installing every daily build.

Python 3.11.2 install log

Today when I made another completely fresh python 3.8 environment it seems to have installed successfully, which is a first. It didn't use any nightly packages, but still needed to test hundreds of different packages for compatibility and took over 20 minutes to do the install - and my computer is reasonably well specced.
Python 3.8 install

Anyway despite it looking like it worked, some of the python import lines still seem to fail:

2023-04-13 12:54:25.349815: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2023-04-13 12:54:25.349995: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\read_weights.py:28: FutureWarning: In the future np.objectwill be defined as the corresponding NumPy scalar. np.uint8, np.uint16, np.object, np.bool] Traceback (most recent call last): File "main.py", line 8, in <module> from tflite_model_maker import model_spec File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tflite_model_maker\__init__.py", line 44, in <module> from tflite_model_maker import audio_classifier File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tflite_model_maker\audio_classifier\__init__.py", line 24, in <module> from tensorflow_examples.lite.model_maker.core.data_util.audio_dataloader import DataLoader File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflow_examples\lite\model_maker\core\data_util\audio_dataloader.py", line 27, in <module> from tensorflow_examples.lite.model_maker.core.task.model_spec import audio_spec File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflow_examples\lite\model_maker\core\task\model_spec\__init__.py", line 20, in <module> from tensorflow_examples.lite.model_maker.core.task.model_spec import audio_spec File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflow_examples\lite\model_maker\core\task\model_spec\audio_spec.py", line 29, in <module> from tensorflow_examples.lite.model_maker.core.task import model_util File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflow_examples\lite\model_maker\core\task\model_util.py", line 28, in <module> from tensorflowjs.converters import converter as tfjs_converter File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\__init__.py", line 21, in <module> from tensorflowjs import converters File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\converters\__init__.py", line 21, in <module> from tensorflowjs.converters.converter import convert File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\converters\converter.py", line 35, in <module> from tensorflowjs.converters import keras_h5_conversion as conversion File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\converters\keras_h5_conversion.py", line 33, in <module> from tensorflowjs import write_weights # pylint: disable=import-error File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\write_weights.py", line 25, in <module> from tensorflowjs import read_weights File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\tensorflowjs\read_weights.py", line 28, in <module> np.uint8, np.uint16, np.object, np.bool] File "C:\Users\martin\miniconda3\envs\13042023OldPython\lib\site-packages\numpy\__init__.py", line 305, in __getattr__ raise AttributeError(__former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'object'.np.objectwas a deprecated alias for the builtinobject. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

@MaurizioNaletto-code
Copy link

Same problem for me, in a google colab notebook

@pjpratik pjpratik added the TFLiteModelMaker TFLite Model Maker related issues label Jun 28, 2023
@ldiangelis
Copy link

Another nice way to do this within colab notebooks is to clone the tensorflow repo and then modify the requirements.txt file so you can control the versions of packages installed. Had a few errors, but was able to modify versions and everything worked fine. Make sure you remove the -q flag so you can get the verbose output to find where the dependency errors are.

Clone the repo:
!git clone https://github.com/tensorflow/examples.git

Navigate to the directory with the setup.py script
cd examples/tensorflow_examples/lite/model_maker/pip_package

Install tflite-model-maker and the required dependencies
!pip3 install -e .

If there are errors, modify the requirements.txt file in the model maker dir - when running verbose it will tell you where the error is
and you can modify accordingly.
examples/tensorflow_examples/lite/model_maker

Then keep running (!pip3 install -e . )until there are no errors and you'll be good to go.

@koktavy
Copy link

koktavy commented Sep 6, 2023

I had this same issue using python 3.10 so I tried to use 3.8. Then I hit a new issue with the orbax package which was recently renamed.

Creating a new conda environment with python 3.9 successfully installed without issue.

conda create -n object-detection python=3.9
conda activate object-detection
pip install tflite-model-maker

@daddyfixit
Copy link

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.

@itsprakhar
Copy link

I had this same issue using python 3.10 so I tried to use 3.8. Then I hit a new issue with the orbax package which was recently renamed.

Creating a new conda environment with python 3.9 successfully installed without issue.

conda create -n object-detection python=3.9
conda activate object-detection
pip install tflite-model-maker

Worked for me! Thanks, man!

@FilippoGuarda
Copy link

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.

I'm having the same issues, tried updating pip but it didn't help, I also tried reverting to python 3.9 on my own machine but the program still has problems with the numba version, the required one would be the 0.53 but that particular version is not available

@ldiangelis
Copy link

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.

I'm having the same issues, tried updating pip but it didn't help, I also tried reverting to python 3.9 on my own machine but the program still has problems with the numba version, the required one would be the 0.53 but that particular version is not available

Try installing numba 0.53.0 with: pip install numba==0.53.0
This version works with python 3.9

@StainlessStlRat
Copy link

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.

I'm having the same issues, tried updating pip but it didn't help, I also tried reverting to python 3.9 on my own machine but the program still has problems with the numba version, the required one would be the 0.53 but that particular version is not available

Try installing numba 0.53.0 with: pip install numba==0.53.0 This version works with python 3.9

I also got the issue where it tried downloading a million nightly builds. I tried installing this version of numba but got this

Failed to build numba llvmlite ERROR: Could not build wheels for numba, llvmlite, which is required to install pyproject.toml-based projects

@ldiangelis
Copy link

Yo, @StainlessStlRat ,
You can always clone the tflite-model-maker repo and troubleshoot by modifying the 'requirements.txt' file (this is in the model_maker directory). That way as missing dependencies come up you can modify as needed or install versions of packages with conflicts. The big one to change is the scann version to scann==1.2.8. There are a couple of others that will cause issue, but I'll leave that to you.

Link to pypi: https://pypi.org/project/tflite-model-maker/0.4.3/

git clone https://github.com/tensorflow/examples
cd examples/tensorflow_examples/lite/model_maker/pip_package
pip install -e .

I only imported the tflite_model_maker packages and confirmed they import properly, but did not run any of the examples. That said, this worked as of an hour ago.

@mZadorskii
Copy link

@ldiangelis
whats your python version? are u running in docker? whats the runtime arch? Linux x86_64?
I figured there is no way to run model-maker on m1 chips unless you run in docker

@StainlessStlRat
Copy link

I finally busted out my old Mac and followed the guide and got it to work, but I can't believe I didn't think to run it in Docker. Is there a pre-built image for that? I already trained my models but of course will need to do it again in the future.

@mZadorskii
Copy link

  • I was not able to install model maker lib on differnt docker images (mostly older ubuntu)
  • Based on other threads and commentary I got a feeling that tensorflow is not being actively maintained (dead?)
  • Trying pytorch approach

@FilippoGuarda
Copy link

FilippoGuarda commented Jun 5, 2024

I did manage to use tensorflow lite inside colab by modifying the requirements.txt contained in the model training tutorial.
I am not sure if this can help since the last time I worked on that piece of software was six months ago.

Here is my requirements.txt file

  • Based on other threads and commentary I got a feeling that tensorflow is not being actively maintained (dead?)

yeah, it looks like tensorflow lite has been left on the sideline for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:lite TF Lite related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:windows Windows Build/Installation Issues TF 2.11 Issues related to TF 2.11 TFLiteModelMaker TFLite Model Maker related issues type:bug Bug type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests