similarity icon indicating copy to clipboard operation
similarity copied to clipboard

Installation failed Mac M1

Open max-endeavour opened this issue 3 years ago • 5 comments

Installation

Machine: Mac M1 2021

Installation: Miniconda env. python: 3.9.5 tensorflow: 2.7 (via conda -c apple)

Tried to install both from within jupyter: !pip install tensorflow_similarity

from terminal in conda env: pip install tensorflow_similarity

import tensorflow as tf tf.version '2.7.0'

The error I got is:

ERROR: Cannot install tensorflow-similarity==0.13.0, tensorflow-similarity==0.13.1, tensorflow-similarity==0.13.10, tensorflow-similarity==0.13.11, tensorflow-similarity==0.13.12, tensorflow-similarity==0.13.13, tensorflow-similarity==0.13.14, tensorflow-similarity==0.13.15, tensorflow-similarity==0.13.17, tensorflow-similarity==0.13.18, tensorflow-similarity==0.13.2, tensorflow-similarity==0.13.20, tensorflow-similarity==0.13.21, tensorflow-similarity==0.13.22, tensorflow-similarity==0.13.23, tensorflow-similarity==0.13.24, tensorflow-similarity==0.13.25, tensorflow-similarity==0.13.26, tensorflow-similarity==0.13.27, tensorflow-similarity==0.13.28, tensorflow-similarity==0.13.29, tensorflow-similarity==0.13.3, tensorflow-similarity==0.13.30, tensorflow-similarity==0.13.31, tensorflow-similarity==0.13.32, tensorflow-similarity==0.13.33, tensorflow-similarity==0.13.34, tensorflow-similarity==0.13.35, tensorflow-similarity==0.13.36, tensorflow-similarity==0.13.37, tensorflow-similarity==0.13.38, tensorflow-similarity==0.13.39, tensorflow-similarity==0.13.4, tensorflow-similarity==0.13.4.1, tensorflow-similarity==0.13.40, tensorflow-similarity==0.13.41, tensorflow-similarity==0.13.42, tensorflow-similarity==0.13.43, tensorflow-similarity==0.13.44, tensorflow-similarity==0.13.45, tensorflow-similarity==0.13.5, tensorflow-similarity==0.13.6, tensorflow-similarity==0.13.7, tensorflow-similarity==0.13.8, tensorflow-similarity==0.13.9, tensorflow-similarity==0.14, tensorflow-similarity==0.14.1, tensorflow-similarity==0.14.2, tensorflow-similarity==0.14.3, tensorflow-similarity==0.14.4, tensorflow-similarity==0.14.5, tensorflow-similarity==0.14.6, tensorflow-similarity==0.14.7 and tensorflow-similarity==0.14.8 because these package versions have conflicting dependencies.

...

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

Tried solutions:

Install from conda conda install tensorflow_similarity

max-endeavour avatar Dec 13 '21 17:12 max-endeavour

Hi,

I don't have an M1 to test on at the moment, but I was able to install on a 2019 MacBookPro OS 12.0.1 using the following:

python3 -m venv .env
. .env/bin/activate
pip install --upgrade pip
pip install tensorflow_similarity

This may be an issue related to how Conda handles the older packages. I'll try and get a Conda env setup on my machine to test. The current package setup.py is fairly relaxed on the requirements, and only needs tf >= 2.4 and tfds >= 4.2, but I'll let you know what I find once I get Conda setup or access to an M1.

You could also try pulling from the nightly development build. pip install tfsim-nightly

owenvallis avatar Dec 17 '21 21:12 owenvallis

Hey, Thank you for the follow-up. I've done what you suggest, the answer back is: The conflict is caused by: tensorflow-similarity 0.14.8 depends on tensorflow>=2.4 tensorflow-similarity 0.14.7 depends on tensorflow>=2.4

But when running: `macbook dive_model % python Python 3.9.5 | packaged by conda-forge | (default, Jun 19 2021, 00:24:55) [Clang 11.1.0 ] on darwin Type "help", "copyright", "credits" or "license" for more information.

import tensorflow as tf tf.version '2.7.0'`

Don't understand though. Any idea ?

max-endeavour avatar Dec 19 '21 14:12 max-endeavour

Hi, I moved the tensorflow dep to extras_require. Seems like this is a common pattern to avoid tensorflow install issues.

tensorflow_similarity 0.14.9 contains the fix. Please let me know if this resolves the issue.

Best,

owenvallis avatar Dec 22 '21 22:12 owenvallis

Hi, thank you for the follow-up. Just tried a new installation using pip install tensorflow-similarity == 0.14.9 as suggested.

several errors during the process due to wheels that it cannot install. It ends with the following:

Successfully built pandas umap-learn pynndescent scikit-learn Failed to build nmslib numba numpy llvmlite ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

When I run a conda install numpy, it says the requirements is already satisfied (numpy is installed along with tensorflow.)

Thanks again for your helps, it seems it's moving in the right direction :)

Best

max-endeavour avatar Dec 23 '21 07:12 max-endeavour

I have solve this issue by install nmslib by CFLAGS="-mavx -DWARN(a)=(a)" pip install nmslib then install TensorFlow Similarity by this CFLAGS="-mavx -DWARN(a)=(a)" pip install tensorflow-similarity and it works. credit by https://github.com/nmslib/nmslib/issues/476#issuecomment-998775186

uraibeefnn avatar Sep 15 '22 10:09 uraibeefnn