dwavesystems / dwave-neal

An implementation of a simulated annealing sampler for general Ising model graphs in C++ with a dimod Python wrapper.
https://docs.ocean.dwavesys.com/projects/neal/en/latest
Apache License 2.0
50 stars 44 forks source link

Potential dependency conflicts between dwave-neal and numpy #79

Closed NeolithEra closed 1 year ago

NeolithEra commented 4 years ago

Hi, as shown in the following full dependency graph of dwave-neal, dwave-neal requires numpy >=1.14.0,<2.0.0, dwave-neal requires dimod >=0.7.7 (dimod 0.9.1 will be installed, i.e., the newest version satisfying the version constraint), and directed dependency dimod 0.9.1 transitively introduces numpy >=1.16.0,<2.0.0. Obviously, there are multiple version constraints set for numpy in this project. However, according to pip's “first found wins” installation strategy, numpy 1.18.4 (i.e., the newest version satisfying constraint >=1.14.0,<2.0.0) is the actually installed version. Although the first found package version numpy 1.18.4 just satisfies the later dependency constraint (numpy >=1.16.0,<2.0.0), such installed version is very close to the upper bound of the version constraint of Numpy specified by dimod 0.9.1 . Once dimod upgrades,its newest version will be installed, as dwave-neal does not specify the upper bound of version constraint for dimod. Therefore, it will easily cause a dependency conflict (build failure), if the upgraded dimod version introduces a higher version of Numpy, violating its another version constraint >=1.14.0,<2.0.0. According to the release history of dimod, it habitually upgrates Numpy in its recent releases. For instance, dimod 0.7.0 upgrated Numpy’s constraint from >=1.11.3,<2.0.0 to >=1.14.0,<2.0.0, dimod 0.8.5 upgrated Numpy’s constraint from >=1.14.0,<2.0.0 to >=1.15.0,<2.0.0, and dimod 0.9.0.dev6 upgrated Numpy’s constraint from >=1.15.0,<2.0.0 to >=1.16.0,<2.0.0. As such, it is a warm warning of a potential dependency conflict issue for dwave-neal.

Dependency tree

dwave-neal - 0.5.4
| +- dimod(install version:0.9.1 version range:>=0.7.7)
| | +- numpy(install version:1.18.4 version range:>=1.16.0,<2.0.0)
| | +- six(install version:1.14.0 version range:>=1.10.0,<2.0.0)
| +- numpy(install version:1.18.4 version range:>=1.14.0,<2.0.0)
| +- six(install version:1.14.0 version range:>=1.11.0,<2.0.0) 

Thanks for your help. Best, Neolith

NeolithEra commented 4 years ago

Suggested Solution

  1. Loosen the version range of numpy to be >=1.14.0.
  2. Remove your direct dependency numpy, and use the numpy transitively introduced by dimod.
  3. Change your direct dependency dimod to be >=0.7.7,<=0.9.1. @randomir Which solution do you prefer, 1 ,2 or 3? Please let me know your choice. May I pull a request to solve this issue?
randomir commented 4 years ago

Thank you for bringing this to our attention, @NeolithEra.

Due to existing dependency on numpy (both in Python and C/Cython code), I'm hesitant to remove the upper bound (ad 1), and/or both bounds/defer to dimod (ad 2).

Third solution is too restrictive; patch updates to dimod should be allowed.

I vote for a variation of (3): dimod>=0.7.7,<0.10.0.

randomir commented 1 year ago

Obsoleted by move to dwave-samplers.