joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
347 stars 76 forks source link

Travis CI config is broken #196

Closed JohannesBuchner closed 4 years ago

JohannesBuchner commented 4 years ago

There seems to be an issue importing numpy in travis.

I used conda to avoid these types of problems, e.g. here: https://github.com/JohannesBuchner/nway/blob/master/.travis.yml

1.18s
docker_mtu

docker stop/waiting
resolvconf

resolvconf stop/waiting
git.checkout

3.04s$ git clone --depth=50 https://github.com/joshspeagle/dynesty.git joshspeagle/dynesty

0.01s0.01s$ source ~/virtualenv/python3.6/bin/activate

tr$ python --version

Python 3.6.3

$ pip --version

pip 9.0.1 from /home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages (python 3.6)
install.1

1.75s$ pip install -U pip
install.2

2.80s$ pip install coveralls pyflakes
install.3

4.40s$ pip install matplotlib==2.2.4
install.4

5.27s$ pip install -e .

1.12s$ python runtests.py

No display found. Using non-interactive Agg backend.

/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/scipy/__init__.py:143: UserWarning: NumPy 1.14.5 or above is required for this version of SciPy (detected version 1.13.3)

  UserWarning)

Traceback (most recent call last):

  File "__init__.pxd", line 1035, in numpy.import_array

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/home/travis/build/joshspeagle/dynesty/dynesty/sampler.py", line 20, in <module>

    from scipy.special import logsumexp

  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/scipy/special/__init__.py", line 633, in <module>

    from . import _ufuncs

  File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs

  File "_ufuncs_extra_code_common.pxi", line 34, in init scipy.special._ufuncs_cxx

  File "__init__.pxd", line 1037, in numpy.import_array

ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "runtests.py", line 30, in <module>

    import dynesty

  File "/home/travis/build/joshspeagle/dynesty/dynesty/__init__.py", line 4, in <module>

    from .dynesty import NestedSampler, DynamicNestedSampler

  File "/home/travis/build/joshspeagle/dynesty/dynesty/dynesty.py", line 18, in <module>

    from .nestedsamplers import (UnitCubeSampler, SingleEllipsoidSampler,

  File "/home/travis/build/joshspeagle/dynesty/dynesty/nestedsamplers.py", line 33, in <module>

    from .sampler import Sampler

  File "/home/travis/build/joshspeagle/dynesty/dynesty/sampler.py", line 22, in <module>

    from scipy.misc import logsumexp

ImportError: cannot import name 'logsumexp'

The command "python runtests.py" exited with 1.
JohannesBuchner commented 4 years ago

May need to install a pinned numpy version: https://stackoverflow.com/questions/48054531/runtimeerror-module-compiled-against-api-version-0xc-but-this-version-of-numpy

joshspeagle commented 4 years ago

ugh, well that's annoying. Thanks for bringing this to my attention. I'll merge in #195 since the changes are pretty straightforward and fix this up in the near-term future (hopefully).

MatthieuDartiailh commented 4 years ago

The error seems to occur because pip is not smart enough to update numpy to match scipy version. It actually even says the install is broken. Using a separate virtual environment to run the test in isolation from the pre-installed numpy or upgrading numpy beforehand should fix the issue.

joshspeagle commented 4 years ago

Should now be resolved as of #197. Thanks @MatthieuDartiailh!