3

When I try to run import tensorflow_quantum I get the following error:

2021-08-19 11:03:01.024791: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-08-19 11:03:01.024808: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "/home/sam/.local/lib/python3.9/site-packages/tensorflow_quantum/core/ops/load_module.py", line 42, in load_module
    return load_library.load_op_library(path)
  File "/home/sam/.local/lib/python3.9/site-packages/tensorflow/python/framework/load_library.py", line 58, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/sam/.local/lib/python3.9/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol: _ZN10tensorflow6StatusC1ENS_5error4CodeEN4absl14lts_2020_09_2311string_viewEOSt6vectorINS_10StackFrameESaIS7_EE

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sam/.local/lib/python3.9/site-packages/tensorflow_quantum/__init__.py", line 18, in <module>
    from tensorflow_quantum.core import (append_circuit, get_expectation_op,
  File "/home/sam/.local/lib/python3.9/site-packages/tensorflow_quantum/core/__init__.py", line 17, in <module>
    from tensorflow_quantum.core.ops import (get_expectation_op,
  File "/home/sam/.local/lib/python3.9/site-packages/tensorflow_quantum/core/ops/__init__.py", line 18, in <module>
    from tensorflow_quantum.core.ops.circuit_execution_ops import (
  File "/home/sam/.local/lib/python3.9/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/sam/.local/lib/python3.9/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/sam/.local/lib/python3.9/site-packages/tensorflow_quantum/core/ops/load_module.py", line 46, in load_module
    return load_library.load_op_library(path)
  File "/home/sam/.local/lib/python3.9/site-packages/tensorflow/python/framework/load_library.py", line 58, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.NotFoundError: /home/sam/anaconda3/envs/quantum-env/lib/python3.9/site-packages/tensorflow_quantum/core/ops/_tfq_simulate_ops.so: undefined symbol: _ZN10tensorflow6StatusC1ENS_5error4CodeEN4absl14lts_2020_09_2311string_viewEOSt6vectorINS_10StackFrameESaIS7_EE

So it seems there is some undefined symbol

ZN10tensorflow6StatusC1ENS_5error4CodeEN4absl14lts_2020_09_2311string_viewEOSt6vectorINS_10StackFrameESaIS7_EE

but I don't really know what this means.

I'm using Pop!_OS 21.04, Tensorflow 2.6.0, Tensorflow Quantum 0.6.0, and python 3.9.5. I install Tensorflow Quantum according to the instructions on this page but I still haven't been able to import it in python. I get the same error when I try to run python via the command line, or in Spyder or a Jupyter notebook.

I really have no idea what's going here. I've managed to track down some similar questions/answers here, but the most promising ones simply linked to a page of instructions which currently just gives a 404 error. Any help would be greatly appreciated.

1 Answers1

0

The issue is replicating in TF 2.5 ,2.6 . Tried in 2.4.1 , Edited code : (please try in python 3.7/3.8 )

    pip install -q tensorflow==2.4.1
    pip install -q tensorflow-quantum
    import tensorflow as tf
    import tensorflow_quantum as tfq 

providing gist for reference