Conflict of protobuf versions between tensorflow 2.3.1 and cirq

5.5k Views Asked by At

Currently started to learn TFQ and been trying to do this tutorial of tensorflow authors, but if I run the first line (!pip install -q tensorflow==2.3.1 --user) I get this error:

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. cirq 0.8.0 requires protobuf==3.8.0, but you have protobuf 3.15.7 which is incompatible.

And when I run the second line (!pip install -q tensorflow-quantum --user) I get this one:

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 2.3.1 requires protobuf>=3.9.2, but you have protobuf 3.8.0 which is incompatible.

Cirq 0.8.0 wants protobuf 3.8.0; tensorflow 2.3.1 wants protobuf>=3.9.2 and there is nothing in between and when I do "pip freeze", I only see protobuf==3.8.0, so my pip freeze doesn't see the protobuf 3.15.7 version that the error mentions of (when I do "pip show protobuf" i get the same result of version 3.8.0).

What should I do to prevent this conflict?

Note: Python version = 3.7.9 (couldn't install tf and/or tfq with either 3.8 nor 3.9); OS = Windows 10

1

There are 1 best solutions below

0
On

Installing two different packages on same environment overrides most of the other. This is the way pip works.It is recommended to use virtual environment for each package.

python -m tf_nightly --system-site-packages .\venv
.\venv\Scripts\activate
pip install --upgrade pip
pip install tf-nightly