I’m trying to import Pennylane for the first time and I keep getting this error for ‘import pennylane as qml’:
ImportError Traceback (most recent call last)
in
----> 1 import pennylane as qml
/usr/local/lib/python3.6/dist-packages/pennylane/init.py in
30 import pennylane.operation
31 import pennylane.qnn
—> 32 import pennylane.templates
33 from pennylane._device import Device, DeviceError
34 from pennylane._grad import grad, jacobian, finite_diff
/usr/local/lib/python3.6/dist-packages/pennylane/templates/init.py in
18 from .broadcast import *
19 from .decorator import *
—> 20 from .layer import *
21 from .layers import *
22 from .embeddings import *
/usr/local/lib/python3.6/dist-packages/pennylane/templates/layer.py in
17 # pylint: disable-msg=too-many-branches,too-many-arguments,protected-access
18 from pennylane.templates.decorator import template as temp
—> 19 from pennylane.math import shape
20
21
ImportError: cannot import name ‘shape’
EDIT: I just found a solution. For some reason the later package versions all have import errors. If anyone else gets this run:
pip uninstall pennylane --yes
pip install pennylane==0.12.0
Best of luck!