Forest Plugin Problem

When I use the forest plugin for the Ensemble Classification demo, this message appears:

DistributionNotFound Traceback (most recent call last)
1 n_wires = 4
----> 3 dev0 = qml.device(“forest.qvm”, device=“4q-qvm”)
4 dev1 = qml.device(“qiskit.aer”, wires=4)
5 devs = [dev0, dev1]

/Applications/anaconda3/envs/testrun_project/lib/python3.8/site-packages/pennylane/ in device(name, *args, **kwargs)
186 # loads the device class
–> 187 plugin_device_class = plugin_devices[name].load()
189 if Version(version()) not in Spec(plugin_device_class.pennylane_requires):

/Applications/anaconda3/envs/testrun_project/lib/python3.8/site-packages/pkg_resources/ in load(self, require, *args, **kwargs)
2444 )
2445 if require:
-> 2446 self.require(*args, **kwargs)
2447 return self.resolve()

/Applications/anaconda3/envs/testrun_project/lib/python3.8/site-packages/pkg_resources/ in require(self, env, installer)
2467 # requirements for that extra are purely optional and skip over them.
2468 reqs = self.dist.requires(self.extras)
-> 2469 items = working_set.resolve(reqs, env, installer, extras=self.extras)
2470 list(map(working_set.add, items))

/Applications/anaconda3/envs/testrun_project/lib/python3.8/site-packages/pkg_resources/ in resolve(self, requirements, env, installer, replace_conflicting, extras)
768 if dist is None:
769 requirers = required_by.get(req, None)
–> 770 raise DistributionNotFound(req, requirers)
771 to_activate.append(dist)
772 if dist not in req:

DistributionNotFound: The ‘ruamel.yaml’ distribution was not found and is required by rpcq

Hi @lisaxu,

Welcome to the PennyLane discussion forum!

It seems that you are missing a package that is required by the device. I would try installing it using pip install ruamel.yaml.

If that doesn’t work, you can try following the installation instructions of the Forest plugin and checking that all software tests are passing.


Juan Miguel


I tried doing the installation but my computer gave a message that said I already had it downloaded. However, the code still didn’t work.

This message showed up-
Requirement already satisfied: ruamel.yaml in /Applications/anaconda3/envs/testrun_project/lib/python3.8/site-packages (0.15.87)

Hi @lisaxu,

This is strange. The error message you are getting states that you are missing a distribution, but the distribution is installed! I know the feeling, these issues can be frustrating.

Have you tried checking that the PennyLane-Forest plugin is correctly installed? It should be enough to run make test in the source code folder. If that doesn’t show any errors, then the other thing that comes to mind is that there may be an issue with using python 3.8. You could try using 3.6, which appears to be the version used during development of the plugin.

If you’re still experiencing issues, let me know and I can contact the plugin developers directly.


Juan Miguel

Issue details

Had almost the same error appear on a machine using WSL 2:

ImportError while loading conftest '/pennylane-forest/tests/'.
tests/ in <module>
    from ruamel import yaml
E   ModuleNotFoundError: No module named 'ruamel'

Both pip and conda recognized ruamel-yaml as a package that was installed, however, conda gave no information on how it was installed.

When tried uninstalling/upgrading with pip, got:

ERROR: Cannot uninstall 'ruamel-yaml'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

This error message lead to a discussion for pip.


Removing every folder & file related to ruamel_yaml manually by rm -r ~/anaconda3/lib/python3.8/site-packages/ruamel_yaml* worked fine . Afterwords I could install ruamel-yaml using pip.

There are further suggestions too in the linked GitHub thread.

1 Like