Closed
Description
Describe the bug
When working with xarray, I get a fatal error when running code after installing bottleneck. Without bottleneck the code runs fine.
To Reproduce
from collections import OrderedDict
import numpy as np
import xarray as xr
# Build some dataset
dirs = np.linspace(0,360, num=121)
freqs = np.linspace(0,4,num=192)
spec_data = np.random.random(size=(192,121))
data = [spec_data]
dims = ('time', 'freq', 'dir')
coords = OrderedDict()
coords['time'] = [0,]
coords['freq'] = freqs
coords['dir'] = dirs
print('constructing data-array')
xdata = xr.DataArray(
data=data, coords=coords, dims=dims, name='Spec name',
).to_dataset()
print('transposing data-array')
print('getting max')
print(xdata.max()) # works fine
tdata = xdata.transpose(..., "freq")
print('getting max')
print(tdata.max()) # <==== Process finished with exit code -1073741819 (0xC0000005)
print('done!')
Using win64, this code runs fine in an environment without bottleneck:
name: ws
dependencies:
- python=3.9
- pandas=1.2.4 # pinned to older version without bottleneck requirement
- xarray
channels:
- defaults
- conda-forge
resulting in:
# Name Version Build Channel
ca-certificates 2021.10.26 haa95532_2
importlib-metadata 4.8.2 py39hcbf5309_0 conda-forge
importlib_metadata 4.8.2 hd8ed1ab_0 conda-forge
intel-openmp 2021.4.0 haa95532_3556
libblas 3.9.0 12_win64_mkl conda-forge
libcblas 3.9.0 12_win64_mkl conda-forge
liblapack 3.9.0 12_win64_mkl conda-forge
mkl 2021.4.0 h0e2418a_729 conda-forge
numpy 1.21.4 py39h6635163_0 conda-forge
openssl 1.1.1l h2bbff1b_0
pandas 1.2.4 py39hf11a4ad_0
pip 21.3.1 pyhd8ed1ab_0 conda-forge
python 3.9.7 h6244533_1
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.9 2_cp39 conda-forge
pytz 2021.3 pyhd3eb1b0_0
setuptools 59.1.1 py39hcbf5309_0 conda-forge
six 1.16.0 pyhd3eb1b0_0
sqlite 3.36.0 h2bbff1b_0
tbb 2021.4.0 h59b6b97_0
typing_extensions 4.0.0 pyha770c72_0 conda-forge
tzdata 2021e hda174b7_0
ucrt 10.0.20348.0 h57928b3_0 conda-forge
vc 14.2 h21ff451_1
vs2015_runtime 14.29.30037 h902a5da_5 conda-forge
wheel 0.37.0 pyhd3eb1b0_1
xarray 0.20.1 pyhd8ed1ab_0 conda-forge
zipp 3.6.0 pyhd3eb1b0_0
When adding bottleneck to the environment, either by doing mamba install bottleneck or by adding it to the yml file the script terminates on getting max().
name: ws
dependencies:
- python=3.9
- pandas=1.2.4
- xarray
- bottleneck
channels:
- defaults
- conda-forge
resulting in:
# Name Version Build Channel
bottleneck 1.3.2 py39h7cc1a96_1
ca-certificates 2021.10.26 haa95532_2
importlib-metadata 4.8.2 py39hcbf5309_0 conda-forge
importlib_metadata 4.8.2 hd8ed1ab_0 conda-forge
intel-openmp 2021.4.0 haa95532_3556
libblas 3.9.0 12_win64_mkl conda-forge
libcblas 3.9.0 12_win64_mkl conda-forge
liblapack 3.9.0 12_win64_mkl conda-forge
mkl 2021.4.0 h0e2418a_729 conda-forge
numpy 1.21.4 py39h6635163_0 conda-forge
openssl 1.1.1l h2bbff1b_0
pandas 1.2.4 py39hf11a4ad_0
pip 21.3.1 pyhd8ed1ab_0 conda-forge
python 3.9.7 h6244533_1
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.9 2_cp39 conda-forge
pytz 2021.3 pyhd3eb1b0_0
setuptools 59.1.1 py39hcbf5309_0 conda-forge
six 1.16.0 pyhd3eb1b0_0
sqlite 3.36.0 h2bbff1b_0
tbb 2021.4.0 h59b6b97_0
typing_extensions 4.0.0 pyha770c72_0 conda-forge
tzdata 2021e hda174b7_0
ucrt 10.0.20348.0 h57928b3_0 conda-forge
vc 14.2 h21ff451_1
vs2015_runtime 14.29.30037 h902a5da_5 conda-forge
wheel 0.37.0 pyhd3eb1b0_1
xarray 0.20.1 pyhd8ed1ab_0 conda-forge
zipp 3.6.0 pyhd3eb1b0_0
So really the only change is
bottleneck 1.3.2 py39h7cc1a96_1
Expected behavior
Script should not crash