tensorflow/recommenders

Not possible to run the basic retrieval example

pksinghus opened this issue ยท 8 comments

Version mismatches in tensorflow , tensorflow_datasets, tensorflow_recommenders, scann and python. Impossible to find a combination that works.

You get error messages about something wrong with builder.py in protobof. You upgrade protobuf then you get errors that tensorflow_datasets doesn't have a method called "load". Then something else breaks, then something else.

The ridiculous hack described here worked for me:

pip install --upgrade protobuf
# Open a terminal and execute:
# mkdir -p ~/protobuf_hack
# cp ~/anaconda3/envs/tensorflow2_p310/lib/python3.10/site-packages/google/protobuf/internal/builder.py protobuf_hack/
pip install protobuf==3.19.6

Appreciate your answer. I tried that. I was able to get past builder.py. But then tensorflow_datasets blows up or tensorflow_recommenders blows up. I tried python 3.10 and 3.9 as well. I see that you are on 3.10, so I'll try to go through the loop again. I had to do a custom build of scann. For which I had to build bezel version 4.

Which version of tensorflow, tensorflow_datasets and tensorflow_recommenders were you on?

I apply the hack after installing all other packages (and ignoring the package conflict warnings).

> pip freeze | grep tensor
tensorboard==2.11.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.11.0
tensorflow-datasets==4.9.2
tensorflow-estimator==2.11.0
tensorflow-io-gcs-filesystem==0.29.0
tensorflow-metadata==1.13.1
tensorflow-recommenders==0.7.3
tensorflow-serving-api==2.11.0

Thanks a lot @rlcauvin. I started with your list as a base, added builder.py and my own build of scann wheel (using bezel 4, pip install scann wouldn't work for me). After a few attempts with pip install now I am able to run the code. I ended up with tensorflow-recommenders==0.7.2. This was a great help, thank you very much.

Yes, I posted an issue about this here a week ago, no response.

It gets worse with tutorials like the one on listwise ranking since that one also requires tensorflow_ranking in the same environment.

I've gotten as far as having tensorflow 2.11, tf_recommenders, tf_datasets and scann run inside a single environment (although pip will still report protobuf version conflicts that I cannot resolve, so something might break at any moment).

I get that the tensorflow ecosystem is rather big at this point, but having basic tutorials not work in Colab (let alone getting them to run in offline environments) seems like a problem to me.

I had seen your ticket and upvoted it. I also saw that there was no response for 2 weeks so I thought I would create another one.

I am stuck at scann. I thought I had a successful scann build but apparently not. I am on a Mac. I will have to go to an EC2 Linux machine and do it all over again.

Like you said, non working samples in colab environment is a problem. I created the ticket only after the colab environment failed. I had been stuck on my Mac for sometime but I was thinking the hosted environment would work.

And it looks like nobody is looking at the issues. This is bad. They could specify the versions of the libraries being used in the samples. Latest doesn't work everytime. But in this case I don't think they can because there just isn't any version combination that will work. Maybe someone had an environment set up on their machine for years and never had to bother with it again.

For recommenders, datasets and scann I built a docker environment from tf/tf:2.11.1-gpu and forced protobuf 3.20.3:

FROM tensorflow/tensorflow:2.11.1-gpu

RUN python3 -m pip install --upgrade pip && \
    pip install jupyterlab tensorflow-recommenders scann && \
    pip install --upgrade tensorflow-datasets

RUN python3 -m pip install protobuf==3.20.3

As I said, pip may still indicate conflicts, but so far I've had no errors importing or using those libraries.

..Same problem here. Incompatibility problems with tf.keras, tf and scann. For some time now I have been having incompatibility problems with different tensorflow libraries