AgnostiqHQ / covalent

Pythonic tool for orchestrating machine-learning/high performance/quantum-computing workflows in heterogeneous compute environments.
https://www.covalent.xyz
Apache License 2.0
770 stars 91 forks source link

Support for pennylane >=0.33.0 (and thereby newer versions of numpy) #1871

Open Andrew-S-Rosen opened 11 months ago

Andrew-S-Rosen commented 11 months ago

What should we add?

https://github.com/AgnostiqHQ/covalent/issues/1845#issue-1985069011

Recently, Pennylane has removed the operations attribute from their DefaultQubit class which means the following error might be thrown for users installing covalent in a new environment [with pennylane >= 0.33.0]: AttributeError: type object 'DefaultQubit' has no attribute 'operations'

Because of the above issue, the maximum version of pennylane is fixed (which also fixes the maximum version of numpy as a result). I'm opening an issue just so this is logged somewhere.

Describe alternatives you've considered.

No response

Andrew-S-Rosen commented 11 months ago

Looks like this is the offending line: https://github.com/AgnostiqHQ/covalent/blob/e45bd30d38aa4ee339a1a4b8fd3393a6d21c00d2/covalent/_workflow/qdevice.py#L45

@kessler-frost: Is the QEDevice.operations attribute actually used anywhere? I couldn't spot it from a quick search in the codebase, but maybe I missed it.

kessler-frost commented 11 months ago

@Andrew-S-Rosen so when creating a new device in Pennylane there are some attributes that the custom device is required to have, essentially describing what are all the operations and observables that this particular device supports as not all devices can physically support all operations/observables. This is why here we are simply making our device support whatever the default device supports. This is why you couldn't find it in the codebase :sweat_smile: because it's something that is required by pennylane when defining a custom device.

Andrew-S-Rosen commented 11 months ago

@kessler-frost: Ah, that explains it! So then in order to resolve this issue, we basically need to swap out the required attributes (if any) and then would need to pin a lower-bound version on pennylane if I understand correctly.

kessler-frost commented 11 months ago

That is correct.

kessler-frost commented 10 months ago

Sorry @Andrew-S-Rosen , but I think this issue will be blocked by #1877 😓 . We don't currently have tests enabled for the qelectrons (which are the reason behind the Pennylane dependency), thus we cannot know whether upgrading to version 33 will break the feature or not (or if the feature has gotten broken due to a recent change yet).

Andrew-S-Rosen commented 10 months ago

@kessler-frost: Makes perfect sense to me! I was admittedly relying blind on the test suite for this since I don't know anything about pennylane. I'll go ahead and close this!

Edit: Oops, I thought this was a PR. The issue should still be kept open until it's resolved!

kessler-frost commented 10 months ago

I'd say even your PR should be open 😅 . I can comment on there once it's resolved. Until then you can keep it in draft mode instead I believe.

Andrew-S-Rosen commented 10 months ago

Sounds good!!