oslocyclotronlab / ompy

A python implementation of the Oslo method
https://ompy.readthedocs.io
GNU General Public License v3.0
7 stars 7 forks source link

Travis tests for macOS fails: `ValueError: numpy.ndarray size changed, may indicate binary incompatibility` #178

Closed fzeiser closed 3 years ago

fzeiser commented 3 years ago

The Travis tests for macOS (with and without libomp) fail on the current master, 70c3d66, with following error message:

______________________ ERROR collecting test_firstgen.py _______________________
tests/test_firstgen.py:3: in <module>
    import ompy as om
ompy/__init__.py:14: in <module>
    from ompy.rebin import *
ompy/rebin.pyx:1: in init ompy.rebin
    import numpy as np
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
[...]

More info: https://travis-ci.com/github/oslocyclotronlab/ompy/jobs/479103734

and https://docs.travis-ci.com/user/reference/osx/:

Travis CI uses macOS 10.13 and Xcode 9.4.1 by default.

I've only changed some comments in the getting-started notebook, which is not part of the tests currently. So there is some other problem. I'm not 100% convinced that this occurs for other users.

vetlewi commented 3 years ago

I can confirm that I can reproduce this on my laptop. Note that this also occurs when I checkout commits that are previously passed (05a3a503866acdfa36931fbb01c9d8eb337495fc) so the error probably is somewhere else.

vetlewi commented 3 years ago

Update: I just updated numpy from v1.19.5 to v1.20.0 and everything works.

fzeiser commented 3 years ago

Maybe some changes / updates to some packages for macOS? Travis build/tested 05a3a50 without problems 18 days ago: https://travis-ci.com/github/oslocyclotronlab/ompy/builds/213479922

(and from a brief inspection I see that at least cython, numpy and scipy ) apparently have the same version in both builds

Downloading Cython-0.29.21-cp37-cp37m-macosx_10_9_x86_64.whl (1.9 MB)
Downloading scipy-1.6.0-cp37-cp37m-macosx_10_9_x86_64.whl (30.7 MB)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/site-packages (1.18.1)
vetlewi commented 3 years ago

Maybe some changes / updates to some packages for macOS? Travis build/tested 05a3a50 without problems 18 days ago: https://travis-ci.com/github/oslocyclotronlab/ompy/builds/213479922

(and from a brief inspection I see that at least cython, numpy and scipy ) apparently have the same version in both builds

Downloading Cython-0.29.21-cp37-cp37m-macosx_10_9_x86_64.whl (1.9 MB)
Downloading scipy-1.6.0-cp37-cp37m-macosx_10_9_x86_64.whl (30.7 MB)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/site-packages (1.18.1)

There might have been a macOS update that broke compatibility?

For future tests, maybe add a script that outputs the versions of all packages before running the tests? Following example of python code outputs useful diagnostics (if ran in ipython):

import numpy
import cython
import pandas
import matplotlib
import pymultinest
import scipy
import uncertainties
import tqdm
import pathos
import pybind11

import watermark

%load_ext watermark
%watermark -m -u -d -v -iv -w

Result:

Last updated: 2021-02-05

Python implementation: CPython
Python version       : 3.9.1
IPython version      : 7.19.0

Compiler    : Clang 12.0.0 (clang-1200.0.32.27)
OS          : Darwin
Release     : 20.2.0
Machine     : x86_64
Processor   : i386
CPU cores   : 8
Architecture: 64bit

cython       : 0.29.21
pybind11     : 2.6.1
numpy        : 1.20.0
pymultinest  : 2.11
matplotlib   : 3.3.3
pathos       : 0.2.7
watermark    : 2.1.0
pandas       : 1.2.0
scipy        : 1.6.0
tqdm         : 4.56.0
uncertainties: 3.1.5

Watermark: 2.1.0
fzeiser commented 3 years ago

Closed through #182.