# Error when trying to create a strawberryfields.tf device

**URL:** <https://discuss.pennylane.ai/t/error-when-trying-to-create-a-strawberryfields-tf-device/1027>\
**Category:** PennyLane Strawberry Fields\
**Created:** [May 10, 2021, 2:21am UTC](https://discuss.pennylane.ai/t/error-when-trying-to-create-a-strawberryfields-tf-device/1027 "2021-05-10T02:21:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denis-Stanev](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Denis-Stanev](https://discuss.pennylane.ai/u/Denis-Stanev)\
**Post date:** [May 10, 2021, 2:21am UTC](https://discuss.pennylane.ai/t/error-when-trying-to-create-a-strawberryfields-tf-device/1027/1 "2021-05-10T02:21:57Z")

</div>

When I try to run the following piece of code:

`dev = qml.device('strawberryfields.tf', wires=6, cutoff_dim=3)`

I get the error:

```
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-a9c3d55d3613> in <module>
----> 1 dev = qml.device('strawberryfields.tf', wires=6, cutoff_dim=3)

C:\ProgramData\Anaconda3\envs\Pennylane14TF\lib\site-packages\pennylane\ __init__.py in device(name, *args, **kwargs)
    251 
    252 # load device
--> 253 return plugin_device_class(*args, **options)
    254 
    255 raise DeviceError("Device does not exist. Make sure the required plugin is installed.")

C:\ProgramData\Anaconda3\envs\Pennylane14TF\lib\site-packages\pennylane_sf\tf.py in __init__ (self, wires, cutoff_dim, analytic, shots, hbar)
    191 
    192 def __init__ (self, wires, *, cutoff_dim, analytic=True, shots=1000, hbar=2):
--> 193 super(). __init__ (wires, analytic=analytic, shots=shots, hbar=hbar)
    194 self.cutoff = cutoff_dim
    195 self.params = dict()

C:\ProgramData\Anaconda3\envs\Pennylane14TF\lib\site-packages\pennylane_sf\simulator.py in __init__ (self, wires, analytic, shots, hbar)
     82 self.state = None
     83 self.samples = None
---> 84 self.analytic = analytic
     85 
     86 def execution_context(self):

AttributeError: can't set attribute

```

This code worked fine with Pennylane v0.13.0, but in the new version of Pennylane (v0.15.1) it gives the error I reported above.  
Do I need to change the parameters I pass to the qml.device function, or is it a bug?

---

<div class="post-metadata">

**Author:** ![Maria\_Schuld](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/maria_schuld/32/166_2.png) [@Maria\_Schuld](https://discuss.pennylane.ai/u/Maria_Schuld)\
**Post date:** [May 10, 2021, 6:00am UTC](https://discuss.pennylane.ai/t/error-when-trying-to-create-a-strawberryfields-tf-device/1027/2 "2021-05-10T06:00:54Z")

</div>

Hey @Denis-Stanev,

The error seems to be caused by a the new logic of how `shots` is used to define whether a device is analytic or not (see [here](https://pennylane.readthedocs.io/en/stable/development/release_notes.html) under " Devices do not have an `analytic` argument or attribute anymore.")

Are you sure you have the latest version of the StrawberryFields plugin installed? Could you post the output of `qml.about()` (after importing pennylane as `qml`)?

---

<div class="post-metadata">

**Author:** ![Denis-Stanev](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Denis-Stanev](https://discuss.pennylane.ai/u/Denis-Stanev)\
**Post date:** [May 10, 2021, 3:38pm UTC](https://discuss.pennylane.ai/t/error-when-trying-to-create-a-strawberryfields-tf-device/1027/3 "2021-05-10T15:38:47Z")

</div>

I had version 0.14 of the pennylane-sf plugin installed.  
I have now updated to version 0.15 and it seems to work now.  
Thank you for your help.

---

<div class="post-metadata">

**Author:** ![Maria\_Schuld](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/maria_schuld/32/166_2.png) [@Maria\_Schuld](https://discuss.pennylane.ai/u/Maria_Schuld)\
**Post date:** [May 11, 2021, 12:00pm UTC](https://discuss.pennylane.ai/t/error-when-trying-to-create-a-strawberryfields-tf-device/1027/4 "2021-05-11T12:00:20Z")

</div>

Great, happy to hear you sorted it out!
