tensorflow / text

Making text a first-class citizen in TensorFlow.
https://www.tensorflow.org/beta/tutorials/tensorflow_text/intro
Apache License 2.0
1.23k stars 344 forks source link

Cannot install tensorflow_text in virtual environment of python 3.8 mac m1 #837

Closed sijia-w closed 2 years ago

sijia-w commented 2 years ago

System information

Describe the problem To use the xx_use_md model, I started a virtualenv.

I tried to load the model by

import spacy_universal_sentence_encoder
nlp = spacy_universal_sentence_encoder.load_model('xx_use_md')

Then, I encountered the error:

FileNotFoundError: Op type not registered 'SentencepieceOp' in binary running on MacBook-Air. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed.
 You may be trying to load on a different device from the computational device. Consider setting the `experimental_io_device` option in `tf.saved_model.LoadOptions` to the io_device such as '/job:localhost'.

Guided by the discussion here: https://github.com/tensorflow/tensorflow/issues/38597, I tried to install tensorflow-text in the virtualenv via pip3, but this raised another error:

ERROR: Could not find a version that satisfies the requirement tensorflow-text (from versions: none)
ERROR: No matching distribution found for tensorflow-text

Additionally, I tried to load the model by

import spacy
nlp = spacy.load('xx_use_md')

which raised the error

OSError: [E050] Can't find model 'xx_use_md'. It doesn't seem to be a Python package or a valid path to a data directory.

Then, I used the command pip3 install https://github.com/MartinoMensio/spacy-universal-sentence-encoder-tfhub/releases/download/xx_use_md-0.2.1/xx_use_md-0.2.1.tar.gz#xx_use_md-0.2.1 on https://pypi.org/project/spacy-universal-sentence-encoder/0.2.1/ . Another error happened:

ERROR: Could not find a version that satisfies the requirement tensorflow==2.1.0 (from spacy-universal-sentence-encoder) (from versions: none)
ERROR: No matching distribution found for tensorflow==2.1.0

It is impossible to use the 'xx_use_md' model by import spacy or import spacy_universal_sentence_encoder in the virtualenv. However, when I tried with the same code on Colab, similar errors occurred and were resolved by installing and importing tensowflow_text.

Relevant issue: https://github.com/tensorflow/text/issues/89#issuecomment-1015848485

broken commented 2 years ago

We currently do not have prebuilt packages for Mac M1. Please look at issue #823 or pr #756 for more info.

broken commented 2 years ago

Closing as dupe since we have other issues opened regarding this subject.