tensorflow / quantum

Hybrid Quantum-Classical Machine Learning in TensorFlow
https://www.tensorflow.org/quantum
Apache License 2.0
1.77k stars 558 forks source link

got error when import tensorflow_quantum as tfq #771

Open Piggy-hammer opened 1 year ago

Piggy-hammer commented 1 year ago

when I trying to do import tensorflow_quantum as tfq

I got error like:

NotFoundError: /home/miniconda3/envs/municipal/lib/python3.9/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb

What should I do? My package lists are: python=3.9.0 tensorflow=2.7.0 cirq=0.13.1 tensorflow-quantum=0.6.1

lockwo commented 1 year ago

Usually, my go to advice is just to do a fresh environment with a fresh install. I have encountered a myriad of installation issues (as have others: https://github.com/tensorflow/quantum/issues/602, https://github.com/tensorflow/quantum/issues/714, https://github.com/tensorflow/quantum/issues/180, https://github.com/tensorflow/quantum/issues/711, https://github.com/tensorflow/quantum/issues/571), almost all of which have been solved by completely starting from scratch in a new environment. If the issues persists even in this environment, you can post more details on your setup (OS, other package versions, other TF installations, etc.) and it can progress from there.

owenonline commented 1 year ago

How did you install tensorflow 2.7.0? I receive "ERROR: Could not find a version that satisfies the requirement tensorflow==2.7.0 (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1, 2.12.0, 2.13.0rc0, 2.13.0rc1) ERROR: No matching distribution found for tensorflow==2.7.0" every time I try to install that version on MacOS, Linux, and Windows on Python 3.9, 3.10, and 3.11.

lockwo commented 1 year ago

That's odd, it just worked by default for me. I use Python 3.8 but 3.9 should be supported, and I've done this on Mac and Linux. I would make an issue on tensorflow repo page about this issue, since they probably know a lot more than I do about these issues relating to TF.

knaughttyanyon commented 9 months ago

Duplicate of #798