Skip to content

Commit 9dec496

Browse files
committed
ENH: Require h5py 2.10 for Windows + Python < 3.6
1 parent 12b2ad1 commit 9dec496

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

nibabel/minc2.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@
2525
2626
mincstats my_funny.mnc
2727
"""
28+
import sys
29+
import os
2830
import numpy as np
2931

3032
from .keywordonly import kw_only_meth
3133
from .optpkg import optional_package
32-
h5py, have_h5py, setup_module = optional_package('h5py')
34+
35+
# PY35: A bug affected Windows installations of h5py in Python3 versions <3.6
36+
# due to random dictionary ordering, causing float64 data arrays to sometimes be
37+
# loaded as longdouble (also 64 bit on Windows). This caused stochastic failures
38+
# to correctly handle data caches, and possibly other subtle bugs we never
39+
# caught. This was fixed in h5py 2.10.
40+
# Please see https://github.com/nipy/nibabel/issues/665 for details.
41+
min_h5py = '2.10' if os.name == 'nt' and (3,) <= sys.version_info < (3, 6) else None
42+
h5py, have_h5py, setup_module = optional_package('h5py', min_version=min_h5py)
3343

3444
from .minc1 import Minc1File, MincHeader, Minc1Image, MincError
3545

0 commit comments

Comments
 (0)