qiboteam / qibo

A full-stack framework for quantum computing.
https://qibo.science
Apache License 2.0
294 stars 60 forks source link

qulacs is always a dependency #1409

Closed scarrazza closed 3 months ago

scarrazza commented 3 months ago

I have just realized (thanks to this) that qulacs is always a dependency of qibo when installing with pip. However, I am not sure why this is happening, given that tensorflow and torch are working as expected.

Here the output of a pip install qibo:

Requirement already satisfied: setuptools<71.0.0,>=69.1.1 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (70.3.0)
Requirement already satisfied: tabulate<0.10.0,>=0.9.0 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (0.9.0)
Requirement already satisfied: sympy<2.0.0,>=1.11.1 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (1.13.1)
Requirement already satisfied: networkx<4.0.0,>=3.2.1 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (3.2.1)
Requirement already satisfied: qulacs<0.7.0,>=0.6.4 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (0.6.4.1)
Requirement already satisfied: openqasm3[parser]>=0.5.0 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (1.0.0)
Requirement already satisfied: joblib<2.0.0,>=1.2.0 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (1.4.2)
Requirement already satisfied: scipy<2.0.0,>=1.10.1 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (1.13.1)
Requirement already satisfied: numpy<2.0.0,>=1.26.4 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (1.26.4)
Requirement already satisfied: cma<4.0.0,>=3.3.0 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (3.4.0)
Requirement already satisfied: hyperopt<0.3.0,>=0.2.7 in ./env/lib/python3.10/site-packages (from qibo==0.2.11) (0.2.7)
Requirement already satisfied: tqdm in ./env/lib/python3.10/site-packages (from hyperopt<0.3.0,>=0.2.7->qibo==0.2.11) (4.66.4)
Requirement already satisfied: cloudpickle in ./env/lib/python3.10/site-packages (from hyperopt<0.3.0,>=0.2.7->qibo==0.2.11) (3.0.0)
Requirement already satisfied: py4j in ./env/lib/python3.10/site-packages (from hyperopt<0.3.0,>=0.2.7->qibo==0.2.11) (0.10.9.7)
Requirement already satisfied: future in ./env/lib/python3.10/site-packages (from hyperopt<0.3.0,>=0.2.7->qibo==0.2.11) (1.0.0)
Requirement already satisfied: six in ./env/lib/python3.10/site-packages (from hyperopt<0.3.0,>=0.2.7->qibo==0.2.11) (1.16.0)
Requirement already satisfied: antlr4-python3-runtime<4.14,>=4.7 in ./env/lib/python3.10/site-packages (from openqasm3[parser]>=0.5.0->qibo==0.2.11) (4.13.1)
alecandido commented 3 months ago

Correct, this is what is written in the wheel:

Requires-Dist: cma (>=3.3.0,<4.0.0)
Requires-Dist: hyperopt (>=0.2.7,<0.3.0)
Requires-Dist: joblib (>=1.2.0,<2.0.0)
Requires-Dist: networkx (>=3.2.1,<4.0.0)
Requires-Dist: numpy (>=1.26.4,<2.0.0)
Requires-Dist: openqasm3[parser] (>=0.5.0)
Requires-Dist: qulacs (>=0.6.4,<0.7.0) ; python_version > "3.9" or sys_platform != "darwin"
Requires-Dist: scipy (>=1.10.1,<2.0.0)
Requires-Dist: setuptools (>=69.1.1,<71.0.0)
Requires-Dist: sympy (>=1.11.1,<2.0.0)
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
Requires-Dist: tensorflow (>=2.16.1,<3.0.0) ; (sys_platform == "linux" or sys_platform == "darwin") and (extra == "tensorflow")
Requires-Dist: torch (>=2.1.1,<3.0.0) ; extra == "torch"

It seems that wheels have no mechanism of making a dependency "optional", other marking it as part of an extra. So, the optional entry on its own is Poetry-specific, and forgotten when the package is built.

Indeed, #1410 should resolve the issue.