quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Add `attrs` lower bound in requirements.txt #6633

Closed ryanhill1 closed 5 months ago

ryanhill1 commented 5 months ago
$ pip install cirq-core
$ pip install 'attrs==21.2.0'
$ python
>>> import cirq
...
File ~/anaconda3/envs/py312/lib/python3.12/site-packages/cirq/transformers/gauge_compiling/gauge_compiling.py:23
     20 import functools
     22 from dataclasses import dataclass
---> 23 from attrs import frozen, field
     24 import numpy as np
     26 from cirq.transformers import transformer_api

ModuleNotFoundError: No module named 'attrs'

$ pip install 'attrs==21.3.0'
$ python
>>> import cirq
>>> # works

Any attrs<21.3.0 fails for me when I try to import cirq. And any attrs>=21.3.0 seems to work.

Reference:

NoureldinYosri commented 5 months ago

I don't see how ModuleNotFoundError: No module named 'attrs' could be caused by an old attrs version?! ... if the error was that it can't find one of the functions/classes of the library then it would have made sense ... but module not found is a different thing

maffoo commented 5 months ago

@NoureldinYosri, see the attrs changelog. While the package on pypi has always been called attrs so that is what you would install (pip install attrs), the python package that you would import was previously called attr (import attr). This was confusing, so they added an attrs python package which matches the install name, and this first landed in 21.3.0.

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.81%. Comparing base (5f7881f) to head (f55d42e). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6633 +/- ## ========================================== - Coverage 97.81% 97.81% -0.01% ========================================== Files 1067 1066 -1 Lines 91547 91693 +146 ========================================== + Hits 89546 89687 +141 - Misses 2001 2006 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.