Hello! If applicable, put your complete code example down below. Make sure that your code:
- is 100% self-contained — someone can copy-paste exactly what is here and run it to
reproduce the behaviour you are observing - includes comments
# Put code here
import pennylane as qml
If you want help with diagnosing an error, please put the full error message below:
# Put full error message here
In 2023, my pennylane code could run on this computer. In summer 2024, I typed this: pip install pennylane --upgrade
pip list shows that PennyLane 0.37.0, PennyLane-Lightning 0.37.0 and PennyLane-SF 0.29.1 are installed.
However now my programs have trouble importing pennylane. Here is the error message:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import pennylane as qml
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\__init__.py", line 26, in <module>
import pennylane.numpy
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\numpy\__init__.py", line 87, in <module>
from .wrapper import extract_tensors, tensor_wrapper, wrap_arrays
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\numpy\wrapper.py", line 23, in <module>
from .tensor import tensor
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\numpy\tensor.py", line 25, in <module>
from pennylane.operation import Operator
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\operation.py", line 260, in <module>
from pennylane.math import expand_matrix
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\math\__init__.py", line 37, in <module>
from .matrix_manipulation import expand_matrix, reduce_matrices, get_batch_size
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\math\matrix_manipulation.py", line 24, in <module>
from pennylane.wires import Wires
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\wires.py", line 23, in <module>
from pennylane.pytrees import register_pytree
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\pytrees\__init__.py", line 18, in <module>
from .pytrees import PyTreeStructure, flatten, is_pytree, leaf, register_pytree, unflatten
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\pytrees\pytrees.py", line 21, in <module>
import pennylane.queuing
File "C:\Users\mlowe\anaconda3\lib\site-packages\pennylane\queuing.py", line 560, in <module>
) -> tuple[list[ops_or_meas], list["pennylane.measurements.MeasurementProcess"]]:
TypeError: 'type' object is not subscriptable
Can you help me?
And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about()
.