Problem using the Forest plugin

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

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

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__)"

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

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.

2 Likes

Hey Josh.

I have the same error. I tried doing what you did but it still isn’t working for me.

Hi @SreeramV181,

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__)"
```Could you post the error message you are getting

little remark, what worked for was python setup.py and not pip install !

Hi @barthelemymp

Where did you write this?
I am getting errors while trying to run
pip install pennylane-forest & pip install pyquil
thus I can’t run the tutorials because I get DeviceError: Device does not exist. Make sure the required plugin is installed.

Hi @_risto. What errors are you getting when attempting to install pennylane-forest and pyquil? If you could perhaps start a new thread on the forum and post the outputs there, I could attempt to help you figure out what’s going wrong. :slight_smile:

Hi @theodor

Both times I get:
image

Hi @_risto,

It seems that the issue you’re facing will be related to the immutables package as the wheels cannot be built for that one in particular.

This seems to be a problem related to installing PyQuil in specific, rather than PennyLane or the PennyLane-Forest plugin. Perhaps there’s a lead in the complete traceback, on what might be going wrong. Locally I have immutables==0.6 and pyquil==2.21.0 installed, perhaps it is worth an attempt to try installing those versions in specific.

Perhaps checking your gcc version (C++ compiler) could also help, it might be required by immutables.