I’m trying to develop a qiskit noise model using pennylane-qiskit, but there seems to be some issue between the packages.
Here is the code I’m running in my juptyer notebook.
import qiskit
import pennylane as qml
import qiskit.providers.aer.noise as noise
# create a bit flip error with probability p = 0.01
p = 0.01
my_bitflip = noise.pauli_error([('X', p), ('I', 1 - p)])
# create an empty noise model
my_noise_model = noise.NoiseModel()
# attach the error to the hadamard gate 'h'
my_noise_model.add_quantum_error(my_bitflip, ['h'], [0])
dev4 = qml.device('qiskit.aer', wires=1, noise_model = my_noise_model)
The error is on the last line. Here is the specific error message. I’ve tried reinstalling the packages and fiddling with the different versions but with no luck.
ContextualVersionConflict Traceback (most recent call last)
Cell In[4], line 15
12 # attach the error to the hadamard gate 'h'
13 my_noise_model.add_quantum_error(my_bitflip, ['h'], [0])
---> 15 dev4 = qml.device('qiskit.aer', wires=1, noise_model = my_noise_model)
File /opt/anaconda3/lib/python3.9/site-packages/pennylane/__init__.py:317, in device(name, *args, **kwargs)
314 options.update(kwargs)
316 # loads the device class
--> 317 plugin_device_class = plugin_devices[name].load()
319 if Version(version()) not in SimpleSpec(plugin_device_class.pennylane_requires):
320 raise DeviceError(
321 f"The {name} plugin requires PennyLane versions {plugin_device_class.pennylane_requires}, "
322 f"however PennyLane version {__version__} is installed."
323 )
File /opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py:2516, in EntryPoint.load(self, require, *args, **kwargs)
2509 warnings.warn(
2510 "Parameters to load are deprecated. Call .resolve and "
2511 ".require separately.",
2512 PkgResourcesDeprecationWarning,
2513 stacklevel=2,
2514 )
2515 if require:
-> 2516 self.require(*args, **kwargs)
2517 return self.resolve()
File /opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py:2539, in EntryPoint.require(self, env, installer)
2533 # Get the requirements for this entry point with all its extras and
2534 # then resolve them. We have to pass `extras` along when resolving so
2535 # that the working set knows what extras we want. Otherwise, for
2536 # dist-info distributions, the working set will assume that the
2537 # requirements for that extra are purely optional and skip over them.
2538 reqs = self.dist.requires(self.extras)
-> 2539 items = working_set.resolve(reqs, env, installer, extras=self.extras)
2540 list(map(working_set.add, items))
File /opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py:827, in WorkingSet.resolve(self, requirements, env, installer, replace_conflicting, extras)
824 if not req_extras.markers_pass(req, extras):
825 continue
--> 827 dist = self._resolve_dist(
828 req, best, replace_conflicting, env, installer, required_by, to_activate
829 )
831 # push the new requirements onto the stack
832 new_requirements = dist.requires(req.extras)[::-1]
File /opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py:873, in WorkingSet._resolve_dist(self, req, best, replace_conflicting, env, installer, required_by, to_activate)
870 if dist not in req:
871 # Oops, the "best" so far conflicts with a dependency
872 dependent_req = required_by[req]
--> 873 raise VersionConflict(dist, req).with_context(dependent_req)
874 return dist
ContextualVersionConflict: (websocket-client 0.58.0 (/opt/anaconda3/lib/python3.9/site-packages), Requirement.parse('websocket-client~=1.5.1'), {'qiskit-ibmq-provider'})
Thank you in advance for the help