coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

Issue with coverage and numpy.min

Open samcoveney opened this issue 3 years ago • 2 comments

This bug was report here and concerns ndarray.min() causing coverage tests to fail (note that numpy.min(ndarray) works fine).

It seems very difficult to reproduce, but in short using a command along the lines of

coverage run --source=dipy.align._public -m pytest -s --doctest-modules --verbose dipy/align/tests/test_api.py

would cause errors like the following to occur anywhere with ndarray.min()

    def _amin(a, axis=None, out=None, keepdims=False,
              initial=_NoValue, where=True):
>       return umr_minimum(a, axis, None, out, keepdims, initial, where)
E       TypeError: float() argument must be a string or a number, not '_NoValueType'

though confusingly, this was not consistent even within the same Python environment. It seems to have somehow depended on the loading of many other packages, in a way that I cannot isolate. The issue appears to be with the 'initial' argument to ndarray.min(), as providing this argument would also fix the problem.

I sorry to say that when creating a truly minimal example, as shown in here, the problem disappeared. While it is therefore tempting to blame the dipy package somehow (which might be correct to do), another experienced user was not able to reproduce the bug despite quite some effort.

My version of coverage was 6.3.2, and downgrading to 6.0.0 fixed the issue. Every other attempt to downgrade other packages failed to solve the issue.

Ubuntu 20.04.4 LTS Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21) Coverage version 6.3.2

Output of pip.freeze

bsl-py==1.0.0
aiohttp==3.8.1
aiosignal==1.2.0
astunparse==1.6.3
async-timeout==4.0.2
asynctest==0.13.0
atomicwrites==1.4.0
attrs @ file:///home/conda/feedstock_root/build_artifacts/attrs_1640799537051/work
backcall @ file:///home/conda/feedstock_root/build_artifacts/backcall_1592338393461/work
backports.functools-lru-cache @ file:///home/conda/feedstock_root/build_artifacts/backports.functools_lru_cache_1618230623929/work
cachetools==4.2.4
certifi==2021.10.8
charset-normalizer==2.0.12
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1631273254894/work
coverage==6.3.2
cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1635519461629/work
Cython==0.29.27
cytoolz==0.11.2
dask @ file:///home/conda/feedstock_root/build_artifacts/dask-core_1643407156653/work
decorator==4.4.2
dicom2nifti @ file:///home/conda/feedstock_root/build_artifacts/dicom2nifti_1622035074417/work
-e git+ssh://[email protected]/samcoveney/dipy.git@120fe8fb79e3b60726763f9876d36f962b693053#egg=dipy
entrypoints @ file:///home/conda/feedstock_root/build_artifacts/entrypoints_1643888246732/work
flatbuffers==2.0
fonttools @ file:///home/conda/feedstock_root/build_artifacts/fonttools_1643722425517/work
frozenlist==1.3.0
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1645566723803/work
fury==0.8.0
future @ file:///home/conda/feedstock_root/build_artifacts/future_1635819510385/work
gast==0.4.0
google-auth==2.3.3
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
grpcio==1.43.0
h5py==2.10.0
idna==3.3
imagecodecs-lite @ file:///home/conda/feedstock_root/build_artifacts/imagecodecs-lite_1636571357104/work
imageio==2.6.1
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1646003248740/work
iniconfig @ file:///home/conda/feedstock_root/build_artifacts/iniconfig_1603384189793/work
ipykernel @ file:///tmp/build/80754af9/ipykernel_1596206598566/work/dist/ipykernel-5.3.4-py3-none-any.whl
ipython==7.31.1
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1637175076767/work
jupyter-client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1642858610849/work
jupyter-core @ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1645024288521/work
keras==2.7.0
Keras-Preprocessing==1.1.2
kiwisolver @ file:///home/conda/feedstock_root/build_artifacts/kiwisolver_1635836699543/work
libclang==12.0.0
locket==0.2.0
Markdown==3.3.6
matplotlib @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-suite_1639358971400/work
matplotlib-inline==0.1.3
more-itertools @ file:///home/conda/feedstock_root/build_artifacts/more-itertools_1637732846337/work
multidict==6.0.2
munkres==1.1.4
nest-asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1638419302549/work
networkx @ file:///home/conda/feedstock_root/build_artifacts/networkx_1617499744980/work
nibabel @ file:///home/conda/feedstock_root/build_artifacts/nibabel_1644264968592/work
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1640083064494/work
oauthlib==3.1.1
olefile @ file:///home/conda/feedstock_root/build_artifacts/olefile_1602866521163/work
opt-einsum==3.3.0
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1637239678211/work
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1638334955874/work
partd @ file:///home/conda/feedstock_root/build_artifacts/partd_1617910651905/work
pep8==1.7.1
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1602535608087/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1602536217715/work
Pillow==9.0.1
pluggy @ file:///home/conda/feedstock_root/build_artifacts/pluggy_1610318091726/work
prompt-toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1644497866770/work
protobuf==3.19.3
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1609419310487/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl
py @ file:///home/conda/feedstock_root/build_artifacts/py_1636301881863/work
pyasn1==0.4.8
pyasn1-modules==0.2.8
pydicom @ file:///home/conda/feedstock_root/build_artifacts/pydicom_1633185052031/work
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1641580240686/work
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1642753572664/work
pytest==7.0.1
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1626286286081/work
PyWavelets @ file:///home/conda/feedstock_root/build_artifacts/pywavelets_1638209732773/work
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1636139801027/work
pyzmq @ file:///home/conda/feedstock_root/build_artifacts/pyzmq_1635877395563/work
requests==2.27.1
requests-oauthlib==1.3.0
rsa==4.8
scikit-image @ file:///home/conda/feedstock_root/build_artifacts/scikit-image_1639751509653/work
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy_1637806658031/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1620240208055/work
tensorboard==2.7.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.7.0
tensorflow-estimator==2.7.0
tensorflow-io-gcs-filesystem==0.23.1
termcolor==1.1.0
tifffile==2019.7.26.2
toml @ file:///home/conda/feedstock_root/build_artifacts/toml_1604308577558/work
tomli @ file:///home/conda/feedstock_root/build_artifacts/tomli_1644342247877/work
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1636177962100/work
tornado @ file:///home/conda/feedstock_root/build_artifacts/tornado_1635819587639/work
tqdm==4.62.3
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1635260543454/work
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1644850595256/work
unicodedata2 @ file:///home/conda/feedstock_root/build_artifacts/unicodedata2_1640030998004/work
urllib3==1.26.8
vtk==9.1.0
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1600965781394/work
Werkzeug==2.0.2
wrapt==1.13.3
wslink==1.4.1
yarl==1.7.2
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1643828507773/work

samcoveney avatar Mar 01 '22 10:03 samcoveney

Have you made any progress on narrowing this down, or reproducing it? I can't imagine how these things could interact badly, but I've seen stranger things :)

nedbat avatar May 22 '22 19:05 nedbat

Since downgrading to fix the issue, I have moved on. I had a very hard time isolating the bug. But the fact that downgrading (as explained above) fixed the issue, suggests that the issue was this package (in my opinion).

On Sun, 22 May 2022, 8:11 pm Ned Batchelder, @.***> wrote:

Have you made any progress on narrowing this down, or reproducing it? I can't imagine how these things could interact badly, but I've seen stranger things :)

— Reply to this email directly, view it on GitHub https://github.com/nedbat/coveragepy/issues/1334#issuecomment-1133955671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWFRHJNELC7GWS7UCGMD5TVLKBFJANCNFSM5PTSMFWQ . You are receiving this because you authored the thread.Message ID: @.***>

samcoveney avatar May 23 '22 08:05 samcoveney

Feel free to re-open this if you get more information about how to reproduce it.

nedbat avatar Sep 04 '22 14:09 nedbat