scikit-hep / pyhf

pure-Python HistFactory implementation with tensors and autodiff
https://pyhf.readthedocs.io/
Apache License 2.0
285 stars 84 forks source link

loosen numpy requirements for non-extra installs #224

Closed lukasheinrich closed 6 years ago

lukasheinrich commented 6 years ago

Description

we are pretty restrictive in the numpy version range due to trying to conform to TF's valid range, but TF is only one of the backends. If just installing pip install pyhf we should not force users to a speciic range unless we require the APIs

numpy>=1.14.0 should be enough unless i'm missing something. @kratsg since you changed this last, any reason you see to restrict numpy further?

matthewfeickert commented 6 years ago

Related, I'm seeing conflicts in PR #228 and I now see that we have tensorflow==1.10.0 and coverage==4.0.3 and jsonschema==v3.0.0a2.

@kratsg @lukasheinrich Do coverage and jsonschema need to be pinned to those exact versions? Also, why is tensorflow pinned at all?

lukasheinrich commented 6 years ago

I'm not sure why tensorflow is pinned. maybe @kratsg knows? I think jsonschema is there because of the discussin @kratsg had here: https://github.com/Julian/jsonschema/issues/454#issuecomment-414709969 coverage could be released but pytest has a minimum requirement

matthewfeickert commented 6 years ago

Yeah, I unpinned tensorflow in PR #228 (now set to tensorflow>=1.10.0), and I somewhat answered my questions with regards to coverage (now set to coverage>=4.0) and jsonschema just by playing around with installs in a Docker container. Thanks for the link though, that's helpful info.

We should still look at if we can set numpy>=1.14.0 though.

lukasheinrich commented 6 years ago

yes, that would be good

matthewfeickert commented 6 years ago

I think the difficult thing here (and I could be wrong, I'm not super well versed in all this) is that as extras_require is a

...dictionary mapping names of “extras” (optional features of your project)...

with the emphasis on "optional", then install_requires will always take precedence.

So if I were to do

git clone https://github.com/diana-hep/pyhf.git && cd pyhf
sed -i -e 's/numpy<=1.14.5,>=1.14.3/numpy>=1.14.0/' setup.py
pip install -e .[tensorflow]

then during the install you get the warning

tensorflow 1.10.1 has requirement numpy<=1.14.5,>=1.13.3, but you'll have numpy 1.15.1 which is incompatible.

as

pip freeze | grep numpy
numpy==1.15.1

So I guess the question here is if it is possible to tell setuptools that it should give precedence to extras_require and/or override install_requires with extras_require?

I've also asked about this on SO in case that speeds things up.