I have the Apple M1 Pro chip and cannot get my tensorflow project running. I followed the installation instructions from Apple's site.
When I run pip install -r requirements.txt, all my python packages install except for tflite-model-maker. I get the following error:
ERROR: Cannot install -r requirements.txt (line 19) and tflite-support because these package versions have conflicting dependencies.
The conflict is caused by:
tflite-model-maker 0.3.4 depends on tensorflow>=2.6.0
tflite-model-maker 0.3.3 depends on tensorflow>=2.6.0
tflite-model-maker 0.3.2 depends on tensorflow>=2.4.0
tflite-model-maker 0.3.1 depends on tensorflow>=2.4.0
tflite-model-maker 0.3.0 depends on tensorflow>=2.4.0
tflite-model-maker 0.2.5 depends on tensorflow>=2.4.0
The user requested tflite-support
tflite-model-maker 0.2.4 depends on tflite-support==0.1.0rc4
tflite-model-maker 0.2.3 depends on tf-nightly==2.4.0.dev20200902
tflite-model-maker 0.2.2 depends on tf-nightly==2.4.0.dev20200902
tflite-model-maker 0.2.1 depends on tf-nightly==2.4.0.dev20200811
tflite-model-maker 0.2.0 depends on tf-nightly==2.4.0.dev20200810
tflite-model-maker 0.1.2 depends on tf-nightly
The user requested tflite-support
tflite-model-maker 0.1.1 depends on tflite-support==0.1.0a0
The user requested tflite-support
tflite-model-maker 0.1.0 depends on tflite-support==0.1.0a0
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
Any ideas?
I had the same problem, the official release of tflite_model_maker doesn't support M1 chip yet.
But you can convert your model without installing the library:
1- Install TensorFlow: I used this tutorial: works perfectly: https://sudhanva.me/install-tensorflow-on-apple-m1-pro-max/
2- create your model using Keras os load it:
import tensorflow
model = tensorflow.keras.models.load_model(load_weights)
3- Convert your model to tflite:
converter = tensorflow.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()
with open('new_model.tflite', 'wb') as f:
f.write(tflite_model)
Related
I am seeing following error while trying to install pip3 install -r requirements.txt, which downgrade my tf version from 2.10 to 2.7, and dependencies. I assume I can pip3 uninstall tensorflow-serving-api and the rests manually one by one, then rerun the installation. Not sure if this will potentially cause issues, wonder if there this a better automatic way ?
WARNING: Ignoring invalid distribution -olorlog (/usr/local/lib/python3.7/site-packages)
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-serving-api 2.9.1 requires tensorflow<3,>=2.9.1, but you have tensorflow 2.7.1 which is incompatible.
tensorflow-metadata 1.10.0 requires absl-py<2.0.0,>=0.9, but you have absl-py 0.8.1 which is incompatible.
tensorflow-metadata 1.10.0 requires protobuf<4,>=3.13, but you have protobuf 3.10.0 which is incompatible.
tensorflow-datasets 4.6.0 requires protobuf>=3.12.2, but you have protobuf 3.10.0 which is incompatible.
googleapis-common-protos 1.56.0 requires protobuf>=3.12.0, but you have protobuf 3.10.0 which is incompatible.
google-cloud-storage 2.2.1 requires google-auth<3.0dev,>=1.25.0, but you have google-auth 1.13.1 which is incompatible.
google-api-core 2.7.1 requires google-auth<3.0dev,>=1.25.0, but you have google-auth 1.13.1 which is incompatible.
google-api-core 2.7.1 requires protobuf>=3.12.0, but you have protobuf 3.10.0 which is incompatible.
I have TensorFlow (2.8.0) installed and running on my Apple Silicon M1 MacBook. But facing dependency error on trying to install tensorflow-federated with the below error on running pip install tensorflow-federated in terminal :
ERROR: Cannot install tensorflow-federated==0.1.0, tensorflow-federated==0.10.0, tensorflow-federated==0.10.1, tensorflow-federated==0.11.0, tensorflow-federated==0.12.0, tensorflow-federated==0.13.0, tensorflow-federated==0.13.1, tensorflow-federated==0.14.0, tensorflow-federated==0.15.0, tensorflow-federated==0.16.0, tensorflow-federated==0.16.1, tensorflow-federated==0.17.0, tensorflow-federated==0.18.0, tensorflow-federated==0.19.0, tensorflow-federated==0.2.0, tensorflow-federated==0.20.0, tensorflow-federated==0.21.0, tensorflow-federated==0.22.0, tensorflow-federated==0.3.0, tensorflow-federated==0.4.0, tensorflow-federated==0.5.0, tensorflow-federated==0.6.0, tensorflow-federated==0.7.0 and tensorflow-federated==0.9.0 because these package versions have conflicting dependencies.
The conflict is caused by:
tensorflow-federated 0.22.0 depends on tensorflow~=2.8.0
tensorflow-federated 0.21.0 depends on tensorflow~=2.8.0
tensorflow-federated 0.20.0 depends on tensorflow~=2.8.0
tensorflow-federated 0.19.0 depends on tensorflow~=2.5.0
tensorflow-federated 0.18.0 depends on tensorflow-addons~=0.12.0
tensorflow-federated 0.17.0 depends on tensorflow~=2.3.0
tensorflow-federated 0.16.1 depends on tensorflow-addons~=0.10.0
tensorflow-federated 0.16.0 depends on tensorflow-addons~=0.10.0
tensorflow-federated 0.15.0 depends on tensorflow-addons~=0.10.0
tensorflow-federated 0.14.0 depends on tensorflow~=2.2.0
tensorflow-federated 0.13.1 depends on tensorflow~=2.1.0
tensorflow-federated 0.13.0 depends on tensorflow~=2.1.0
tensorflow-federated 0.12.0 depends on tensorflow~=2.1.0
tensorflow-federated 0.11.0 depends on tensorflow-addons~=0.6.0
tensorflow-federated 0.10.1 depends on tensorflow-addons~=0.6.0
tensorflow-federated 0.10.0 depends on tensorflow-addons~=0.6.0
tensorflow-federated 0.9.0 depends on tf-nightly
tensorflow-federated 0.7.0 depends on tf-nightly
tensorflow-federated 0.6.0 depends on tf-nightly
tensorflow-federated 0.5.0 depends on tf-nightly
tensorflow-federated 0.4.0 depends on tensorflow~=1.13
tensorflow-federated 0.3.0 depends on tensorflow~=1.13
tensorflow-federated 0.2.0 depends on tensorflow~=1.13
tensorflow-federated 0.1.0 depends on tensorflow>=1.13.0rc2
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
Could you follow the instructions for M1 from here to install Tensorflow and it's dependencies on a new virtual environment and then install the tensorflow-federated.
I was successfully able to install tensorflow-federated along with all it's dependencies mentioned below on my M1 with Tensorflow 2.8 version.
Successfully installed attrs-21.2.0 cachetools-3.1.1 cloudpickle-2.0.0 cycler-0.11.0 decorator-5.1.1 dill-0.3.4 dm-tree-0.1.7 farmhashpy-0.4.0
googleapis-common-protos-1.56.1 grpcio-1.34.1 importlib-resources-5.7.1
jax-0.2.28 jaxlib-0.1.76 joblib-1.1.0 kiwisolver-1.4.2 kubernetes-21.7.0
matplotlib-3.3.4 numpy-1.21.6 pandas-1.1.5 pillow-9.1.1 portpicker-1.3.
promise-2.3 pyparsing-3.0.9 python-dateutil-2.8.2 pytz-2022.1 pyyaml-6.0
scikit-learn-1.0.2 scipy-1.5.4 semantic-version-2.8.5 tensorflow-2.8.1
tensorflow-datasets-4.5.2 tensorflow-estimator-2.8.0 tensorflow-federated-0.24.0
tensorflow-io-gcs-filesystem-0.26.0 tensorflow-metadata-1.8.0
tensorflow-model-optimization-0.7.2 tensorflow-privacy-0.8.0
tensorflow-probability-0.15.0 threadpoolctl-3.1.0 tqdm-4.28.1 websocket-client-1.3.2
When going through the process of installing OpenVino as documented here, I'm running:
sudo ./install_prerequisites.sh
and getting
ERROR: Could not find a version that satisfies the requirement tensorflow~=2.4.1 (from versions: 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.8.0rc0)
ERROR: No matching distribution found for tensorflow~=2.4.1
As suggested in the documentation, you can configure frameworks individually if there are errors. However, even using pip it doesn't seem there is a matching distribution for Tensorflow 2.4.1:
pip install tensorflow==2.4.1
ERROR: No matching distribution found for tensorflow==2.4.1
How can you get Tensorflow 2.4.1 installed?
I've already shown you how to debug such problems. Well, let's see.
The list of available packages for tensorflow 2.4.1 includes wheels for Python 3.6-3.8. No 3.9 and no source code. Wheels for Python 3.9 are available starting from tensorflow 2.5.0rc0 — exactly like is said in the error message.
What can you do? 1) Downgrade once more, to Python 3.8. Or 2) Use more recent OpenVino source code; the current sources at GitHub list tensorflow~=2.5 as a dependency. Or 3) Find in your downloaded sources files requirements*.txt and replace version tensorflow~=2.4.1 with 2.5.0.
when I use pip install tensorflow command that error appear :-
'''
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tf-nightly 2.6.0.dev20210601 requires gast==0.4.0, but you have gast 0.3.3 which is incompatible.
tf-nightly 2.6.0.dev20210601 requires h5py~=3.1.0, but you have h5py 2.10.0 which is incompatible.
tf-nightly 2.6.0.dev20210601 requires numpy~=1.19.2, but you have numpy 1.18.5 which is incompatible.'''
Looks like you are trying to install Tensorflow and tf-nightly on the same environment. Since Tensorflow and tf-nightly uses same code, you should never install both in same environment. Latest version overrides the most of the packages, thats how pip works. It recommended to use virtual environment each tensorflow version.
Tf-nightly require gast==0.4.0 and numpy==1.19.2.
Follow the below steps
python -m tf_nightly --system-site-packages .\venv
.\venv\Scripts\activate
pip install --upgrade pip
pip install tf-nightly
I'm running the following Google Colab, but when I run the following command, I get the below error:
!pip install -U tfx
--
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
multiprocess 0.70.11.1 requires dill>=0.3.3, but you have dill 0.3.1.1 which is incompatible.
jupyter-console 5.2.0 requires prompt-toolkit<2.0.0,>=1.0.0, but you have prompt-toolkit 3.0.18 which is incompatible.
google-colab 1.0.0 requires ipython~=5.5.0, but you have ipython 7.24.0 which is incompatible.
google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.25.1 which is incompatible.
datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.
I did face similar problem with !pip install fiftyone but when I did repeat the syntax the problem gone.