How to Setup the TFLite Model analyser and Optimizer on your Conda Personal Environment.
- vidyakamath1004
- Dec 5, 2022
- 2 min read
Open the Terminal of the Environment you are using on your Conda.

Install the pipenv to create a new virtual environment for tflite analyser.
pip install pipenv
If you encounter any error try to upgrade your pip and install pipenv again.
Now create a virtual environment and launch it using the following commands
pipenv install
pipenv shell
You must be able to view something like this once the new environment is launched.
Now you need to clone the github repo here. I personally prefer to download the repo and paste it in the directory where the anaconda exist.
I have cloned the Repo in my Github which you can find in the link below.
If you would prefer to fork from the Original github page use the below link instead.
https://github.com/eliberis/tflite-tools
If you still dont figure out how to donwload the repo, use the zip file below which is a clone of the
repo downloaded on 5th Dec 2022.
Once you have your repo, extract the zip and place the folder in the directory were your anaconda
exists. By default it would be C:\Users\YOUR_USER_NAME\
Next, we need to check if the tflite_tools.py is working so just test it with the --help argument.
First, change the path to the location the tflite_tools.py in the cloned directory using the following
cd C:\Users\YOUR_USER_NAME\tflite-tools-master\tflite-tools-masterUse the follwing to test that your tflite analyser is correctly installed and all dependencies are met.
python tflite_tools.py --helpIf all goes well you will be able to see something like this.

CONGRATS YOU ARE GOOD TO GO ... START USING THE ANALYSER ON YOUR MODEL.TFLITE FILES !!!
FEW PROBLEMS THAT I ENCOUNTERED DURING THE INSTALLATION AND HOW I SOLVED THEM.
No module named 'flatbuffers'
This error was a difficult one and I tried installing flatbuffers using conda-forge. It still was the same even after installing the flatbuffers.

I realised its something to do with the path and copied the flatbuffers folders from the library and lib folders in my conda environment, to my virtual environment library and lib folders.

This solved the flatbuffer error but gave a new error with numpy!! I uninstalled and reinstalled numpy and then a new error came for prettytable!!!!! and again!! even if I install prettytable, the error wouldnt just go!

Long set of issues. The actual problem was that these packages whether already present or freshly installed would be just available under your conda enviornment
"C:\Users\YOUR_USER_NAME\anaconda3\envs\your_conda_env\lib\..." ,
"C:\Users\YOUR_USER_NAME\anaconda3\envs\your_conda_env\include\..."
and "C:\Users\YOUR_USER_NAME\anaconda3\envs\your_conda_env\library\..."
but would be missing in the newly created virtual environment using pipenv
"C:\Users\MAHE\.virtualenvs\YOUR_VIRTUAL_ENV_NAME\lib\...",
"C:\Users\MAHE\.virtualenvs\YOUR_VIRTUAL_ENV_NAME\include\...",
and "C:\Users\MAHE\.virtualenvs\YOUR_VIRTUAL_ENV_NAME\library\..."
I then copied the lib , include, and library directories from the conda env folder to the new virtual env folder. Took a while to copy all the packages form the conda env to the virtual env.
So, this worked and finally my virtual env was running and the analyser finally worked.




Comments