timothydmorton / isochrones

Pythonic stellar model grid access; easy MCMC fitting of stellar properties
http://isochrones.readthedocs.org
MIT License
119 stars 63 forks source link

Installation errors (issue with numba version?) #92

Closed tcjansen closed 4 years ago

tcjansen commented 5 years ago

I had some problem with installation, but I think it's fixed now - at any rate I thought I would post the issue I was having so that if someone else encounters the same thing, they can find it here.

Here's what was happening (with python 3.5): After pip installing isochrones (with forced upgrades), I ran >>> nosetests isochrones and got a whole fleet of errors, the first of which was the following:

MultiNest Warning: no resume file found, starting from scratch
 *****************************************************
 MultiNest v3.10
 Copyright Farhan Feroz & Mike Hobson
 Release Jul 2015

 no. of live points =   20
 dimensionality =    5
 *****************************************************
Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "//anaconda/lib/python3.5/site-packages/pymultinest/run.py", line 212, in loglike
    return LogLikelihood(cube, ndim, nparams)
  File "//anaconda/lib/python3.5/site-packages/isochrones/starmodel.py", line 1561, in mnest_loglike
    return self.lnpost(cube)
  File "//anaconda/lib/python3.5/site-packages/isochrones/starmodel.py", line 506, in lnpost
    lnpr = self.lnprior(p)
  File "//anaconda/lib/python3.5/site-packages/isochrones/starmodel.py", line 1547, in lnprior
    feh=pars[self.feh_index])
  File "//anaconda/lib/python3.5/site-packages/isochrones/priors.py", line 129, in lnpdf
    pdf = self.pdf(x, **kwargs)
  File "//anaconda/lib/python3.5/site-packages/isochrones/priors.py", line 53, in pdf
    return self._pdf(x, **kwargs) / self._norm
  File "//anaconda/lib/python3.5/site-packages/isochrones/priors.py", line 409, in _pdf
    orig_val, dx_deep = self.ic.interp_value(pars, [self.orig_par, self.deriv_prop]).squeeze()
  File "//anaconda/lib/python3.5/site-packages/isochrones/models.py", line 373, in interp_value
    return self.model_grid.interp(pars, props)
  File "//anaconda/lib/python3.5/site-packages/isochrones/interp.py", line 666, in __call__
    values = interp_value_3d(*args)
  File "//anaconda/lib/python3.5/site-packages/numba/dispatcher.py", line 285, in _compile_for_args
    return self.compile(tuple(argtypes))
  File "//anaconda/lib/python3.5/site-packages/numba/dispatcher.py", line 531, in compile
    cres = self._compiler.compile(args, return_type)
  File "//anaconda/lib/python3.5/site-packages/numba/dispatcher.py", line 80, in compile
    flags=flags, locals=self.locals)
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 725, in compile_extra
    return pipeline.compile_extra(func)
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 369, in compile_extra
    return self.compile_bytecode(bc, func_attr=self.func_attr)
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 378, in compile_bytecode
    return self._compile_bytecode()
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 690, in _compile_bytecode
    return self._compile_core()
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 677, in _compile_core
    res = pm.run(self.status)
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 257, in run
    raise patched_exception
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 249, in run
    stage()
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 404, in stage_analyze_bytecode
    interp = translate_stage(self.bc)
  File "//anaconda/lib/python3.5/site-packages/numba/compiler.py", line 791, in translate_stage
    interp = interpreter.Interpreter(bytecode=bytecode)
  File "//anaconda/lib/python3.5/site-packages/numba/interpreter.py", line 154, in __init__
    self.reset()
  File "//anaconda/lib/python3.5/site-packages/numba/interpreter.py", line 169, in reset
    self.dfa.run()
  File "//anaconda/lib/python3.5/site-packages/numba/dataflow.py", line 27, in run
    self.infos[blk.offset] = self.run_on_block(blk)
  File "//anaconda/lib/python3.5/site-packages/numba/dataflow.py", line 71, in run_on_block
    self.dispatch(info, inst)
  File "//anaconda/lib/python3.5/site-packages/numba/dataflow.py", line 80, in dispatch
    fn = getattr(self, fname)
AttributeError: Failed at nopython (analyzing bytecode)
'DataFlowAnalysis' object has no attribute 'op_MAKE_FUNCTION'

and after many more errors, the nosetests ended with:

Ran 22 tests in 467.737s
FAILED (errors=10)

It seems that many, if not all, of the errors were associated with numba and AttributeError: Failed at nopython (analyzing bytecode). The nosetests passed after forcing a numba upgrade (from v0.28 to v0.43). Maybe the package requirements should change to reflect this?

timothydmorton commented 4 years ago

Thanks for this-- including numba in the requirements in setup.py had caused other problems in the past, which is why it isn't there. My currently suggested installation method is to create a conda env with numpy=1.15 numba cython nose pytables pandas and to install isochrones in that env. When I get around to #106 it will be possible to conda install isochrones, and that should fix this.