tensorflow.python.framework.errors_impl.NotFoundError. .local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol:
Shuhul24 opened this issue · 4 comments
While importing tensorflow quantum, the following error is being shown:
Traceback (most recent call last):
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/load_module.py", line 42, in load_module
return load_library.load_op_library(path)
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow/python/framework/load_library.py", line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringERKNS_15OpKernelContextEb
Followed by another exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/__init__.py", line 18, in <module>
from tensorflow_quantum.core import (append_circuit, get_expectation_op,
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/__init__.py", line 17, in <module>
from tensorflow_quantum.core.ops import (get_expectation_op,
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/__init__.py", line 18, in <module>
from tensorflow_quantum.core.ops.circuit_execution_ops import (
File "/home/tanishq18/.local/lib/python3.7/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 "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/tfq_simulate_ops.py", line 19, in <module>
SIM_OP_MODULE = load_module("_tfq_simulate_ops.so")
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/load_module.py", line 46, in load_module
return load_library.load_op_library(path)
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow/python/framework/load_library.py", line 54, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/aakash/anaconda3/lib/python3.7/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: cannot open shared object file: No such file or directory
Some important information regarding libraries"
tensorflow-quantum==0.7.2
cirq-core==1.0.0
pathos==0.2.5
tensorflow==2.9.1
What should be done?
Check the requirements. The latest main branch requires tensorflow==2.7.0
. I almost always just use the latest release (which is TFQ 0.6.2).
Well, I think there is no version of tensorflow-quantum==0.6.2
. I think the version that you are talking about is tensorflow-quantum==0.7.2
. Also, I checked along the requirements and have upgraded (and downgraded) some of the packages according to it.
Now it shows some different type of error.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/__init__.py", line 18, in <module>
from tensorflow_quantum.core import (append_circuit, get_expectation_op,
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/__init__.py", line 17, in <module>
from tensorflow_quantum.core.ops import (get_expectation_op,
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/__init__.py", line 18, in <module>
from tensorflow_quantum.core.ops.circuit_execution_ops import (
File "/home/tanishq18/.local/lib/python3.7/site-packages/tensorflow_quantum/core/ops/circuit_execution_ops.py", line 18, in <module>
import cirq
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq/__init__.py", line 637, in <module>
create_attribute=True,
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq/_compat.py", line 626, in deprecated_submodule
new_module = importlib.import_module(new_module_name)
File "/home/aakash/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq_aqt/__init__.py", line 19, in <module>
from cirq_aqt.aqt_sampler import AQTSampler, AQTSamplerLocalSimulator
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq_aqt/aqt_sampler.py", line 34, in <module>
from cirq_aqt.aqt_device import AQTSimulator, get_op_string
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq_aqt/aqt_device.py", line 34, in <module>
from cirq_aqt import aqt_device_metadata
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq_aqt/aqt_device_metadata.py", line 24, in <module>
from cirq_aqt import aqt_target_gateset
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq_aqt/aqt_target_gateset.py", line 26, in <module>
class AQTTargetGateset(cirq.TwoQubitCompilationTargetGateset):
File "/home/tanishq18/.local/lib/python3.7/site-packages/cirq/_compat.py", line 685, in __getattr__
return getattr(parent_module, name)
AttributeError: module 'cirq' has no attribute 'TwoQubitCompilationTargetGateset'
Same error occurs while import cirq
. What should be done?
I was actually talking about 0.6.1 which is the latest release. You can see all the releases here: https://github.com/tensorflow/quantum/releases (and that 0.6.1 is the latest). As for your error, I recommend starting a completely new environment, I have had similar experiences when trying to changes existing versions. I just started a brand new environment did
!pip install tensorflow==2.7.0
!pip install tensorflow_quantum
print(tf.__version__)
print(tfq.__version__)
2.7.0
0.7.2
ran some example TFQ code and had no problems.
It worked for me as well. Thanks a lot ! It was really helpful.