Problem charging forest device


#1

Hello,

I’m doing the serie of tutorials, to learn a bit about PennyLane.
So far everything was working just fine, but then I tried the PyTorch tutorial, which start by using a forest devices. I installed the forest software and the plugin, however when I run :

import pennylane as qml
import torch
from torch.autograd import Variable
dev = qml.device('forest.qvm', device='2q', noisy=True)

I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-2cf089c8119a> in <module>
----> 1 dev = qml.device('forest.qvm', device='2q', noisy=True)

~\.conda\envs\penny\lib\site-packages\pennylane\__init__.py in device(name, *args, **kwargs)
    210 
    211         # load plugin device
--> 212         return plugin_device_class(*args, **options)
    213 
    214     raise DeviceError('Device does not exist. Make sure the required plugin is installed.')

~\.conda\envs\penny\lib\site-packages\pennylane_forest\qvm.py in __init__(self, device, shots, noisy, **kwargs)
     91                              "a valid QVM quantum computer, or a NetworkX graph object.")
     92 
---> 93         super().__init__(num_wires, shots, **kwargs)
     94 
     95         # get the qc

~\.conda\envs\penny\lib\site-packages\pennylane_forest\device.py in __init__(self, wires, shots, **kwargs)
    187     def __init__(self, wires, shots, **kwargs):
    188         super().__init__(wires, shots)
--> 189         self.forest_url = kwargs.get('forest_url', pyquil_config.compiler_url)
    190         self.qvm_url = kwargs.get('qvm_url', pyquil_config.qvm_url)
    191         self.compiler_url = kwargs.get('compiler_url', pyquil_config.compiler_url)

AttributeError: 'PyquilConfig' object has no attribute 'compiler_url'

I have to admit that I have no idea how to solve it, so any help would be welcome.

All the best,

b


#2

Hi barthelemymp,

There are breaking changes in the latest versions of Rigetti software, and it affects PennyLane. I’m not sure if this is the same issue (@josh knows this better – perhaps he can comment), but we are working with Rigetti to fix the plugin.

Greetings,
Nathan


#3

Hi @barthelemymp, thank you for flagging this! I will take a look and see if I can reproduce the bug.

Can I ask you to run the following three commands, to determine the versions of quilc, QVM, and PyQuil you are using:

quilc --version
qvm --version
python -c "import pyquil; print(pyquil.__version__)"

#4

Hello Josh

Here are the results from the code you asked:

quilc --version
1.6.0 [1d29de5]

qvm --version
1.6.0 [26b5bd8]

python -c "import pyquil; print(pyquil.__version__)"
2.7.0

For this one, It was on the conda environnement I created for penny lane. Maybe there is a problem related the conda environment? Penny lane and the forest plugin are only installed on the envs…

Best regards

Barthélémy


#5

Hi @barthelemymp,

I was able to reproduce the error using the version of PennyLane-Forest installed via pip.

This bug is currently fixed in the latest GitHub master branch of PennyLane-Forest. I will update the pip version so this bug is fixed for users that pip install pennylane-forest ASAP, thank you for letting us know!

In the meantime, you can switch to the GitHub development version as follows:

git clone https://github.com/rigetti/pennylane-forest
cd pennylane-forest && pip install -e .

After running those above two commands, the tutorial linked above should work without error.