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
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 been finished install Tensorflow env step by step from "https://developer.apple.com/metal/tensorflow-plugin/"
Tf is working!numpy is working! scipy is working!
but when i import sklearn package, have an error message like this:
ImportError: dlopen(/Users/mecilmeng/miniforge3/envs/tf/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so, 0x0002): Library not loaded: #rpath/liblapack.3.dylib
Referenced from: /Users/mecilmeng/miniforge3/envs/tf/lib/python3.9/site-packages/scipy/spatial/qhull.cpython-39-darwin.so
Reason: tried: '/Users/mecilmeng/miniforge3/envs/tf/lib/liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/lib/liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/lib/liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/lib/liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/lib/python3.9/site-packages/scipy/spatial/../../../../liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/bin/../lib/liblapack.3.dylib' (no such file), '/Users/mecilmeng/miniforge3/envs/tf/bin/../lib/liblapack.3.dylib' (no such file), '/usr/local/lib/liblapack.3.dylib' (no such file), '/usr/lib/liblapack.3.dylib' (no such file)
How to fix it?
pip list
Package Version
------------------------ -------------------
absl-py 0.10.0
aiohttp 3.8.1
aiosignal 1.2.0
anyio 3.5.0
appnope 0.1.2
argon2-cffi 20.1.0
astunparse 1.6.3
async-generator 1.10
async-timeout 4.0.1
attrs 21.4.0
Babel 2.9.1
backcall 0.2.0
beniget 0.3.0
bleach 4.1.0
blinker 1.4
Bottleneck 1.3.2
brotlipy 0.7.0
cached-property 1.5.2
cachetools 4.2.2
certifi 2021.10.8
cffi 1.15.0
charset-normalizer 2.0.4
click 8.0.3
cryptography 3.4.7
cycler 0.11.0
Cython 0.29.28
debugpy 1.5.1
decorator 5.1.1
defusedxml 0.7.1
dill 0.3.4
entrypoints 0.3
flatbuffers 2.0
fonttools 4.25.0
frozenlist 1.2.0
gast 0.4.0
google-auth 1.33.0
google-auth-oauthlib 0.4.1
google-pasta 0.2.0
googleapis-common-protos 1.54.0
grpcio 1.42.0
h5py 3.1.0
idna 3.3
importlib-metadata 4.8.2
ipykernel 6.4.1
ipython 7.31.1
ipython-genutils 0.2.0
jedi 0.18.1
Jinja2 3.0.2
joblib 1.1.0
json5 0.9.6
jsonschema 3.2.0
jupyter-client 7.1.2
jupyter-core 4.9.1
jupyter-server 1.13.5
jupyterlab 3.2.1
jupyterlab-pygments 0.1.2
jupyterlab-server 2.10.3
keras 2.8.0
Keras-Preprocessing 1.1.2
kiwisolver 1.3.1
libclang 13.0.0
Markdown 3.3.4
MarkupSafe 2.0.1
matplotlib 3.5.0
matplotlib-inline 0.1.2
mistune 0.8.4
multidict 5.2.0
munkres 1.1.4
nbclassic 0.2.6
nbclient 0.5.3
nbconvert 6.3.0
nbformat 5.1.3
nest-asyncio 1.5.1
networkx 2.6.3
notebook 6.4.6
numexpr 2.8.1
numpy 1.22.2
oauthlib 3.1.1
opencv-python 4.5.5.62
opt-einsum 3.3.0
packaging 21.3
pandas 1.3.5
pandocfilters 1.5.0
parso 0.8.3
pexpect 4.8.0
pickleshare 0.7.5
Pillow 9.0.1
pip 21.2.4
ply 3.11
prometheus-client 0.13.1
promise 2.3
prompt-toolkit 3.0.20
protobuf 3.19.1
ptyprocess 0.7.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pybind11 2.9.1
pycparser 2.21
Pygments 2.11.2
PyJWT 2.1.0
pyOpenSSL 21.0.0
pyparsing 3.0.4
pyrsistent 0.18.0
PySocks 1.7.1
python-dateutil 2.8.2
pythran 0.9.11
pytz 2021.3
pyzmq 22.3.0
requests 2.27.1
requests-oauthlib 1.3.0
rsa 4.7.2
scikit-learn 1.0.2
scipy 1.7.1
Send2Trash 1.8.0
setuptools 58.0.4
six 1.15.0
sklearn 0.0
sniffio 1.2.0
tensorboard 2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.6.0
tensorflow-datasets 4.5.2
tensorflow-macos 2.8.0
tensorflow-metadata 1.6.0
tensorflow-metal 0.3.0
termcolor 1.1.0
terminado 0.13.1
testpath 0.5.0
tf-estimator-nightly 2.8.0.dev2021122109
threadpoolctl 2.2.0
tornado 6.1
tqdm 4.62.3
traitlets 5.1.1
typing-extensions 3.7.4.3
urllib3 1.26.8
wcwidth 0.2.5
webencodings 0.5.1
websocket-client 0.58.0
Werkzeug 2.0.2
wheel 0.35.1
wrapt 1.12.1
yarl 1.6.3
zipp 3.7.0
You can install using Rosetta2 Mode.
To work in Rosetta Mode:
If Rosetta 2 is not installed by default in your M1 Mac, then open the pre-installed Terminal app and run the following command:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Rosetta allows us to use apps built for Mac with intel chip.
Several CLI tools do not have native versions built for the new M1 architecture.
Enabling them on your native M1 Mac terminal can be frustrating.
Follow these steps to enable Rosetta:
Select the app(Terminal) in the Finder.
Right click on the app(Terminal) and select Get Info.
In General, check the Open using Rosetta check-box.
Close the Terminal Info.
Now when you quit the terminal and open it again.
If you haven't installed Rosetta yet, then it would prompt you to install it.
If the popup shows up, then click on Install button, then enter your user name and password to allow installation to proceed.
Close the Terminal and open again.
Now we have a special terminal that can install tools with Rosetta translation.
To verify that you are using a Rosetta terminal, run the following command and it should output i386:
arch
The native terminal without Rosetta would output arm64 for the above command.
Moving forward, all commands we ask you to execute should be done in Rosetta enabled terminal.
Uninstall arm64 brew
If you have installed brew in the past from the native terminal, it is likely that you have an arm64 build of brew. Having two different builds of brew can cause major problems as the packages with different builds will not be compatible with each other.
To avoid this problem you need to uninstall your current installation of arm64 brew.
You can check which build you have by running the following command:
which brew
If your installation of brew is the Intel build, then the command should output /usr/local/bin/brew. If that is the case you can skip installing brew and just update your current installation by running brew update.
If your output is /opt/homebrew then your installation of brew is the arm64 build.
You need to uninstall the arm64 build of brew by running the following command from the native terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Install Intel brew
Install Homebrew, which is the package manager:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once done, run the below command to ensure that we make use of the HEAD revision:
git -C $(brew --repository homebrew/core) checkout master
Now verify the installation of the brew command:
which brew
The command should output /usr/local/bin/brew, which is the expected path.
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)
In Colab notebook, I did:
!pip install pandas==1.4.1
but returned:
ERROR: Could not find a version that satisfies the requirement pandas==1.4.1 (from versions: 0.1, 0.2, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5)
ERROR: No matching distribution found for pandas==1.4.1
Any idea how to upgrade to pandas==1.4.1 in colab?
pandas 1.4+ requires Python >= 3.8. From the list of available versions I can guess you use Python 3.7 or lower.
Upgrade Python or use lower version of pandas. Just pip install pandas should find compatible version.
Can we install tensorflow==0.11.0rc0 version in colab , as one of the pre-trained model code I use is coded in this version
You can install any version of TensorFlow in google collab.
However, there are specific versions that are available, so you may want to pick from those options . version 0.11.0rc0 is not currently available.
!pip install tensorflow==1.1.0rc0. #install a tensorflow version
import tensorflow as tf # import tensorflow
print(tf.__version__). # print tensorflow version
Here is the list of available versions as of now.
0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 1.15.3, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.0.2, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0, 2.1.1, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0