Skip to content

Instantly share code, notes, and snippets.

@phaustin
Last active May 21, 2019 16:04
Show Gist options
  • Select an option

  • Save phaustin/c02e2b154d7c8fa8111a4809cc275d04 to your computer and use it in GitHub Desktop.

Select an option

Save phaustin/c02e2b154d7c8fa8111a4809cc275d04 to your computer and use it in GitHub Desktop.
pinning numpy
Hi all, I have a strange behavior in recipes regarding numpy version
I want to build a package that depends on Numpy, the recipe contain the following:
 requirements:
  build:
    - {{ compiler('cxx') }}
    - cmake
  host:
    - xtl >=0.6.2,<0.7
    - xtensor >=0.20.4,<0.21
    - pybind11 >=2.1.0,<2.3
    - numpy
  run:
    - {{ pin_compatible('xtl', max_pin='x.x') }}
    - {{ pin_compatible('xtensor', max_pin='x.x') }}
    - {{ pin_compatible('pybind11', max_pin='x.x') }}
    - {{ pin_compatible('numpy', max_pin='x.x') }}
when building the recipe on conda-forge, the version of numpy that is used is 1.11
while the last available on conda-forge is 1.16
so if I download the package after it has been uploaded, it will force numpy to version 1.11
now, if I replace numpy with numpy >=1.12 (or any version higher than 1.11)
the recipe builds fine on linux and OSX, but fails on Windows

Filipe @ocefpaf 04:37
when building the recipe on conda-forge, the version of numpy that is used is 1.11
That is by design. We build with the oldest possible numpy that has forward compatibility so you can run with all numpys greater than that minimum.
See https://conda-forge.org/docs/maintainer/knowledge_base.html?#building-against-numpy

Johan Mabille @JohanMabille 04:39
ah, thanks for the link
just to be sure I understand correctly

Filipe @ocefpaf 04:39
TL;DR is that, if you need a newer numpy at build time you must specify the min version yourself, but never specify it with >= or you will have to rebuild your package every time a new numpy comes out.
Last but not least we are discussing bumping the minimum b/c of scipy. See conda-forge/conda-forge-pinning-feedstock#228

Johan Mabille @JohanMabille 04:41
if I keep {{ pin_compatible('numpy', max_pin='x.x') }} in the recipe, I force the dependency on Numpy 1.11 (since it was built with 1.11), but if I use {{ pin_compatible('numpy') }}, the dependency can be any version of Numpy that is compatible with 1.11?

Filipe @ocefpaf 04:42
Yep. Avoid the max_pin='x.x'.

Johan Mabille @JohanMabille 04:42
ok, thank you very much!
_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment