amazon-braket-sdk-python icon indicating copy to clipboard operation
amazon-braket-sdk-python copied to clipboard

Incompatible version with Strawberry Fields

Open ianhellstrom opened this issue 2 years ago • 2 comments

Describe the bug antlr4-python3-runtime is incompatible between Braket (and the default simulator) and Strawberry Fields, even though it is pinned because of it: https://github.com/aws/amazon-braket-default-simulator-python/blob/main/setup.py#L38

However, it is pegged to a different version in Blackbird, which is used internally by SF:

https://github.com/XanaduAI/blackbird/blob/master/requirements.txt#L1

Error discovered by using pip-compile on a simple requirements.in file with pip-compile -r requirements.in

amazon-braket-sdk
strawberryfields

Output:

Could not find a version that matches antlr4-python3-runtime==4.8,==4.9.2 (from quantum-blackbird==0.4.0->strawberryfields==0.23.0->-r req.in (line 2))
Tried: 4.4.0, 4.4.1, 4.5, 4.5.2, 4.5.2.1, 4.5.3, 4.6, 4.7, 4.7.1, 4.7.2, 4.8, 4.9, 4.9.1, 4.9.2, 4.9.3, 4.10, 4.11.0, 4.11.0, 4.11.1, 4.11.1
There are incompatible versions in the resolved dependencies:
  antlr4-python3-runtime==4.9.2 (from amazon-braket-default-simulator==1.9.0->amazon-braket-sdk==1.31.1->-r req.in (line 1))
  antlr4-python3-runtime==4.8 (from quantum-blackbird==0.4.0->strawberryfields==0.23.0->-r req.in (line 2))

ianhellstrom avatar Oct 13 '22 13:10 ianhellstrom

The plugin requires the installation of SF: https://github.com/aws/amazon-braket-strawberryfields-plugin-python

This means that blindly installing these with pip can lead to subtle bugs due to differences:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
amazon-braket-default-simulator 1.9.0 requires antlr4-python3-runtime==4.9.2, but you have antlr4-python3-runtime 4.8 which is incompatible.

ianhellstrom avatar Oct 13 '22 13:10 ianhellstrom

Hi @ianhellstrom ,

Thank you for logging this issue. We are working on dealing with this dependency conflict. Meanwhile, if you need to unblock yourself, I suggest you run: pip install amazon-braket-sdk followed by pip install amazon-braket-strawberryfields-plugin as two separate commands.

pip should be able to automatically downgrade antrl to 4.8, which should work for how we currently use it.

Let me know if this helps.

krneta avatar Oct 13 '22 20:10 krneta

Perhaps a silly question, but why not simply use 4.8?

ianhellstrom avatar Oct 19 '22 11:10 ianhellstrom

It seems as if Blackbird 0.5 uses the same version, which is now also used inside 0.23 of SF. Bit scary that package versions are updated in SF post-release... This ticket can therefore be closed.

ianhellstrom-tomtom avatar Oct 19 '22 12:10 ianhellstrom-tomtom