ImportError: cannot import name '_compat' from 'cirq' (unknown location)

208 views Asked by At

I am trying to import the module tensorflow_quantum as follows

>>> import tensorflow_quantum as tfq

But, I get the following error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/__init__.py", line 18, in <module>
    from tensorflow_quantum.core import (append_circuit, get_expectation_op,
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/__init__.py", line 17, in <module>
    from tensorflow_quantum.core.ops import (get_expectation_op,
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/__init__.py", line 18, in <module>
    from tensorflow_quantum.core.ops.circuit_execution_ops import (
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/circuit_execution_ops.py", line 20, in <module>
    from tensorflow_quantum.core.ops import (cirq_ops, tfq_simulate_ops,
  File "/opt/conda/lib/python3.8/site-packages/tensorflow_quantum/core/ops/cirq_ops.py", line 22, in <module>
    import cirq_google
  File "/opt/conda/lib/python3.8/site-packages/cirq_google/__init__.py", line 18, in <module>
    from cirq import _compat
ImportError: cannot import name '_compat' from 'cirq' (unknown location)

I have already installed cirq. It works as follows

>>> import cirq
>>> 

Any help please?

0

There are 0 answers