# 'device-error' in implementation of Tutorial

**URL:** <https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479>\
**Category:** Strawberry Fields\
**Created:** [September 25, 2023, 4:46pm UTC](https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479 "2023-09-25T16:46:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aditya\_Ranjan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/aditya_ranjan/32/1545_2.png) [@Aditya\_Ranjan](https://discuss.pennylane.ai/u/Aditya_Ranjan)\
**Post date:** [September 25, 2023, 4:46pm UTC](https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479/1 "2023-09-25T16:46:48Z")

</div>

Hi,  
I am trying to implement the tutorial on the X8 machine but it is giving me a device-error code.

```auto
import numpy as np

import strawberryfields as sf
from strawberryfields import ops
from strawberryfields import RemoteEngine

from strawberryfields.utils import random_interferometer
U = random_interferometer(4)
np.set_printoptions(precision=16)
print(U)

prog = sf.Program(8, name="remote_job1")

with prog.context as q:
    # Initial squeezed states
    # Allowed values are r=1.0 or r=0.0
    ops.S2gate(1.0) | (q[0], q[4])
    ops.S2gate(1.0) | (q[1], q[5])
    ops.S2gate(1.0) | (q[3], q[7])

    # Interferometer on the signal modes (0-3)
    ops.Interferometer(U) | (q[0], q[1], q[2], q[3])
    ops.BSgate(0.543, 0.123) | (q[2], q[0])
    ops.Rgate(0.453) | q[1]
    ops.MZgate(0.65, -0.54) | (q[2], q[3])

    # *Same* interferometer on the idler modes (4-7)
    ops.Interferometer(U) | (q[4], q[5], q[6], q[7])
    ops.BSgate(0.543, 0.123) | (q[6], q[4])
    ops.Rgate(0.453) | q[5]
    ops.MZgate(0.65, -0.54) | (q[6], q[7])

    ops.MeasureFock() | q
    
eng = RemoteEngine("X8")
results = eng.run(prog, shots=20)
print(results.samples)

```

The full error message below:

```auto
raise FailedJobError(message)
strawberryfields.engine.FailedJobError: The remote job fde5275e-6be1-48a3-ad9b-28378a4ef0aa failed due to an internal server error: {'error-code': 'device-error', 'error-detail': 'The hardware device was unable to process your job request. The error was forwarded to technical support. If this error occurs repeatedly and you would like to follow up on a bugfix, please contact technical support with a copy of this error message, including the job-id.'}. Please try again.

```

The versions of my packages-

numpy 1.23.5  
StrawberryFields 0.23.0

---

<div class="post-metadata">

**Author:** ![kevinkawchak](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/kevinkawchak/32/1801_2.png) [@kevinkawchak](https://discuss.pennylane.ai/u/kevinkawchak)\
**Post date:** [September 25, 2023, 8:57pm UTC](https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479/2 "2023-09-25T20:57:08Z")

</div>

Hello @Aditya_Ranjan,

With your code and !pip install pennylane-sf I receive these results, but a Xanadu Cloud API key is needed.

[[-0.0210856391204191-0.5368303362146857j  
-0.236997009908951 -0.3221738080676012j  
-0.0981514394555408-0.0766895655068101j  
0.686619222752453 -0.2538584035519544j]  
[-0.1821533210322363-0.1231820475285705j  
0.7755162823310933-0.1777750737384837j  
-0.3851438329143497+0.3660680025158925j  
-0.0022191761140666-0.1904478683516187j]  
[ 0.4821502144015314+0.1645902608085209j  
-0.3687081038662368+0.1033382255880174j  
-0.4831880021601475+0.597013581038163j  
0.047045813315011 -0.0413230220243907j]  
[-0.3322383135907148-0.5413629619100713j  
-0.2424604040677547-0.0399433526517151j  
-0.3259732974829684+0.0773886227413599j  
-0.3777990271377379+0.5302656249321172j]]

Reference:  
'[Installation — PennyLane-StrawberryFields 0.29.1 documentation](https://docs.pennylane.ai/projects/strawberryfields/en/latest/installation.html)

---

<div class="post-metadata">

**Author:** ![Aditya\_Ranjan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/aditya_ranjan/32/1545_2.png) [@Aditya\_Ranjan](https://discuss.pennylane.ai/u/Aditya_Ranjan)\
**Post date:** [September 26, 2023, 4:56pm UTC](https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479/3 "2023-09-26T16:56:43Z")

</div>

Hi there,

I have the Cloud API setup. I can also access it as “xcc ping” command tells me that it is successfully connected to “Successfully connected to the Xanadu Cloud.”

I have installed strawberryfield rather than pennylane-sf. Does that make a difference?

Thank you for the reply.

---

<div class="post-metadata">

**Author:** ![Aditya\_Ranjan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/aditya_ranjan/32/1545_2.png) [@Aditya\_Ranjan](https://discuss.pennylane.ai/u/Aditya_Ranjan)\
**Post date:** [September 26, 2023, 8:25pm UTC](https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479/4 "2023-09-26T20:25:13Z")

</div>

Hi,

I tried using pennylane-sf as well. I am getting the same error as before. Any information regarding this would be helpful.

---

<div class="post-metadata">

**Author:** ![CatalinaAlbornoz](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/catalinaalbornoz/32/1196_2.png) [@CatalinaAlbornoz](https://discuss.pennylane.ai/u/CatalinaAlbornoz)\
**Post date:** [September 27, 2023, 11:54am UTC](https://discuss.pennylane.ai/t/device-error-in-implementation-of-tutorial/3479/5 "2023-09-27T11:54:23Z")

</div>

Hi @Aditya_Ranjan and @kevinkawchak ,

The pennylane-sf plugin is only if you want to use PennyLane. I would recommend using Strawberry Fields directly, as you were doing in the beginning. The best is to create a new virtual environment and `pip install xanadu-cloud-client strawberryfields`.

I’m being able to run your code with no issues.

After you create the new virtual environment could you please post the output of `sf.about()` and please post the full error message?
