jvines / astroARIADNE

Easy stellar SED fitting!
MIT License
57 stars 7 forks source link

Used astroARIADNE successfully 7 months ago, but now it's not working #47

Closed jsimonastro closed 1 year ago

jsimonastro commented 1 year ago

Hi @jvines, I used astroARIADNE (v1.0.4) successfully a few months ago, both following the example documentation at https://github.com/jvines/astroARIADNE#how-to-use and then repeating for another star I was interested in.

Now I am trying to run SED fits for some additional stars and am getting the following error output when I execute f.fit_bma():

    *** EXECUTING MAIN FITTING ROUTINE ***
        Selected engine : Bayesian Model Averaging
        Live points : 500
        log Evidence tolerance : 0.5
        Free parameters : 21
        Bounding : multi
        Sampling : rwalk
        N threads : 4

        FITTING MODEL : phoenix
Exception while calling loglikelihood function:Exception while calling loglikelihood function:

  params:  params:  [4.49875288e+03 4.38621460e+00 1.06535067e-01 3.04161756e+02
 3.18372978e+01 2.76671853e-02 5.56825036e-13 1.25118746e-11
 9.76847036e-12 2.99551627e-13 1.46809137e-11 7.34109275e-12
 1.46343189e-12 3.17379768e-11 3.19201142e-12 3.23502443e-12
 1.15033927e-12 5.77440665e-12 3.97464517e-12 8.90418982e-13
 8.63224852e-14][4.95022185e+03 5.29695294e+00 3.30302832e-02 3.04083587e+02
 4.75152486e+01 1.16110056e-03 7.11930505e-13 7.52373481e-12
 1.35164007e-11 2.42227386e-12 1.97628642e-12 2.10433068e-11
 7.22553464e-13 6.84032190e-11 2.37165977e-12 2.55761120e-12
 1.19221240e-11 1.48808472e-11 3.67731605e-13 1.40210925e-13
 3.12097374e-13]

  args:  args:  [][]

  kwargs:  kwargs:  {}{}

  exception:  exception:

Traceback (most recent call last):
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.8/site-packages/dynesty/dynesty.py", line 896, in __call__
    return self.func(np.asarray(x).copy(), *self.args, **self.kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/dynesty/dynesty.py", line 896, in __call__
    return self.func(np.asarray(x).copy(), *self.args, **self.kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/fitter.py", line 1477, in dynesty_log_like
    return log_likelihood(theta, flux, flux_er, wave,
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/fitter.py", line 1477, in dynesty_log_like
    return log_likelihood(theta, flux, flux_er, wave,
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 111, in log_likelihood
    res, ers = get_residuals(theta, flux, flux_er, wave,
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 111, in log_likelihood
    res, ers = get_residuals(theta, flux, flux_er, wave,
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 100, in get_residuals
    model = model_grid(theta, filts, wave, interpolators, use_norm, av_law)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 100, in get_residuals
    model = model_grid(theta, filts, wave, interpolators, use_norm, av_law)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 86, in model_grid
    flux = get_interpolated_flux(teff, logg, z, filts, interpolators)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 86, in model_grid
    flux = get_interpolated_flux(teff, logg, z, filts, interpolators)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 52, in get_interpolated_flux
    flux = interpolators(values, filts)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 52, in get_interpolated_flux
    flux = interpolators(values, filts)
  File "/opt/anaconda3/lib/python3.8/site-packages/isochrones-2.1-py3.8.egg/isochrones/interp.py", line 666, in __call__
    values = interp_value_3d(*args)
  File "/opt/anaconda3/lib/python3.8/site-packages/isochrones-2.1-py3.8.egg/isochrones/interp.py", line 666, in __call__
    values = interp_value_3d(*args)
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 396, in _compile_for_args
    self._compilation_chain_init_hook()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 396, in _compile_for_args
    self._compilation_chain_init_hook()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 289, in _compilation_chain_init_hook
    entrypoints.init_all()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 289, in _compilation_chain_init_hook
    entrypoints.init_all()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/entrypoints.py", line 48, in init_all
    eps = importlib_metadata.entry_points()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/entrypoints.py", line 48, in init_all
    eps = importlib_metadata.entry_points()
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 856, in entry_points
    return EntryPoints(eps).select(**params)
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 856, in entry_points
    return EntryPoints(eps).select(**params)
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 853, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 853, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_py39compat.py", line 18, in normalized_name
    return dist._normalized_name
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_py39compat.py", line 18, in normalized_name
    return dist._normalized_name
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 778, in _normalized_name
    or super()._normalized_name
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 778, in _normalized_name
    or super()._normalized_name
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 445, in _normalized_name
    return Prepared.normalize(self.name)
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 445, in _normalized_name
    return Prepared.normalize(self.name)
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 440, in name
    return self.metadata['Name']
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 440, in name
    return self.metadata['Name']
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 429, in metadata
    or self.read_text('PKG-INFO')
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 429, in metadata
    or self.read_text('PKG-INFO')
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 762, in read_text
    return self._path.joinpath(filename).read_text(encoding='utf-8')
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 762, in read_text
    return self._path.joinpath(filename).read_text(encoding='utf-8')
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py", line 283, in read_text
    return strm.read()
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py", line 282, in read_text
    with self.open('r', *args, **kwargs) as strm:
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py", line 254, in open
    stream = self.root.open(self.at, zip_mode, pwd=pwd)
  File "/opt/anaconda3/lib/python3.8/zipfile.py", line 926, in read
    buf += self._read1(self.MAX_N)
  File "/opt/anaconda3/lib/python3.8/zipfile.py", line 1535, in open
    raise BadZipFile("Bad magic number for file header")
  File "/opt/anaconda3/lib/python3.8/zipfile.py", line 1016, in _read1
    data = self._decompressor.decompress(data, n)
zipfile.BadZipFile: Bad magic number for file header
zlib.error: Error -3 while decompressing data: invalid literal/length code
---------------------------------------------------------------------------
RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.8/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/opt/anaconda3/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/opt/anaconda3/lib/python3.8/site-packages/dynesty/dynesty.py", line 896, in __call__
    return self.func(np.asarray(x).copy(), *self.args, **self.kwargs)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/fitter.py", line 1477, in dynesty_log_like
    return log_likelihood(theta, flux, flux_er, wave,
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 111, in log_likelihood
    res, ers = get_residuals(theta, flux, flux_er, wave,
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 100, in get_residuals
    model = model_grid(theta, filts, wave, interpolators, use_norm, av_law)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 86, in model_grid
    flux = get_interpolated_flux(teff, logg, z, filts, interpolators)
  File "/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py", line 52, in get_interpolated_flux
    flux = interpolators(values, filts)
  File "/opt/anaconda3/lib/python3.8/site-packages/isochrones-2.1-py3.8.egg/isochrones/interp.py", line 666, in __call__
    values = interp_value_3d(*args)
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 396, in _compile_for_args
    self._compilation_chain_init_hook()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py", line 289, in _compilation_chain_init_hook
    entrypoints.init_all()
  File "/opt/anaconda3/lib/python3.8/site-packages/numba/core/entrypoints.py", line 48, in init_all
    eps = importlib_metadata.entry_points()
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 856, in entry_points
    return EntryPoints(eps).select(**params)
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py", line 853, in <genexpr>
    eps = itertools.chain.from_iterable(
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
  File "/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_py39compat.py", line 18, in normalized_name
    return dist._normalized_name
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 778, in _normalized_name
    or super()._normalized_name
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 445, in _normalized_name
    return Prepared.normalize(self.name)
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 440, in name
    return self.metadata['Name']
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 429, in metadata
    or self.read_text('PKG-INFO')
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 762, in read_text
    return self._path.joinpath(filename).read_text(encoding='utf-8')
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py", line 282, in read_text
    with self.open('r', *args, **kwargs) as strm:
  File "/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py", line 254, in open
    stream = self.root.open(self.at, zip_mode, pwd=pwd)
  File "/opt/anaconda3/lib/python3.8/zipfile.py", line 1535, in open
    raise BadZipFile("Bad magic number for file header")
zipfile.BadZipFile: Bad magic number for file header
"""

The above exception was the direct cause of the following exception:

BadZipFile                                Traceback (most recent call last)
<ipython-input-8-b59a045b221c> in <module>
      1 f.initialize()
----> 2 f.fit_bma()

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/fitter.py in fit_bma(self)
    570             print('\t\t\tFITTING MODEL : ' + gr)
    571             try:
--> 572                 self.fit_dynesty(out_file=out_file)
    573             except ValueError as e:
    574                 dump_out = self.out_folder + '/' + gr + '_DUMP.pkl'

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/fitter.py in fit_dynesty(self, out_file)
    711             if self._threads > 1:
    712                 with Pool(self._threads) as executor:
--> 713                     self.sampler = dynesty.NestedSampler(
    714                         dynesty_log_like, pt_dynesty, self.ndim,
    715                         nlive=self._nlive, bound=self._bound,

/opt/anaconda3/lib/python3.8/site-packages/dynesty/dynesty.py in __new__(cls, loglikelihood, prior_transform, ndim, nlive, bound, sample, periodic, reflective, update_interval, first_update, npdim, rstate, queue_size, pool, use_pool, live_points, logl_args, logl_kwargs, ptform_args, ptform_kwargs, gradient, grad_args, grad_kwargs, compute_jac, enlarge, bootstrap, walks, facc, slices, fmove, max_move, update_func, ncdim, blob, save_history, history_filename)
    663             kwargs['compute_jac'] = compute_jac
    664 
--> 665         live_points, logvol_init, init_ncalls = _initialize_live_points(
    666             live_points,
    667             ptform,

/opt/anaconda3/lib/python3.8/site-packages/dynesty/dynamicsampler.py in _initialize_live_points(live_points, prior_transform, loglikelihood, M, nlive, npdim, rstate, blob, use_pool_ptform)
    410                 cur_live_v = map(prior_transform, np.asarray(cur_live_u))
    411             cur_live_v = np.array(list(cur_live_v))
--> 412             cur_live_logl = loglikelihood.map(np.asarray(cur_live_v))
    413             if blob:
    414                 cur_live_blobs = np.array([_.blob for _ in cur_live_logl])

/opt/anaconda3/lib/python3.8/site-packages/dynesty/utils.py in map(self, pars)
    175             ret = [
    176                 LoglOutput(_, self.blob)
--> 177                 for _ in self.pool.map(self.loglikelihood, pars)
    178             ]
    179         if self.save:

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in map(self, func, iterable, chunksize)
    362         in a list that is returned.
    363         '''
--> 364         return self._map_async(func, iterable, mapstar, chunksize).get()
    365 
    366     def starmap(self, func, iterable, chunksize=None):

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in get(self, timeout)
    769             return self._value
    770         else:
--> 771             raise self._value
    772 
    773     def _set(self, i, obj):

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in worker()
    123         job, i, func, args, kwds = task
    124         try:
--> 125             result = (True, func(*args, **kwds))
    126         except Exception as e:
    127             if wrap_exception and func is not _helper_reraises_exception:

/opt/anaconda3/lib/python3.8/multiprocessing/pool.py in mapstar()
     46 
     47 def mapstar(args):
---> 48     return list(map(*args))
     49 
     50 def starmapstar(args):

/opt/anaconda3/lib/python3.8/site-packages/dynesty/dynesty.py in __call__()
    894             # This comes at performance cost, but it's worthwhile
    895             # as it may lead to hard to diagnose weird behaviour
--> 896             return self.func(np.asarray(x).copy(), *self.args, **self.kwargs)
    897         except:  # noqa
    898             print(f"Exception while calling {self.name} function:")

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/fitter.py in dynesty_log_like()
   1475         cube, flux, flux_er, filts, coordinator, fixed, use_norm
   1476     )
-> 1477     return log_likelihood(theta, flux, flux_er, wave,
   1478                           filts, interpolator, use_norm, av_law)
   1479 

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py in log_likelihood()
    109                    av_law):
    110     """Calculate log likelihood of the model."""
--> 111     res, ers = get_residuals(theta, flux, flux_er, wave,
    112                              filts, interpolators, use_norm, av_law)
    113 

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py in get_residuals()
     98                   av_law):
     99     """Calculate residuals of the model."""
--> 100     model = model_grid(theta, filts, wave, interpolators, use_norm, av_law)
    101     start = 5 if use_norm else 6
    102     inflation = theta[start:]

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py in model_grid()
     84         dist *= 4.435e+7  # Transform from pc to solRad
     85 
---> 86     flux = get_interpolated_flux(teff, logg, z, filts, interpolators)
     87 
     88     wav = wave * 1e4

/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE/sed_library.py in get_interpolated_flux()
     50     """
     51     values = (logg, temp, z)
---> 52     flux = interpolators(values, filts)
     53     return flux
     54 

/opt/anaconda3/lib/python3.8/site-packages/isochrones-2.1-py3.8.egg/isochrones/interp.py in __call__()
    664                 and (isinstance(p[2], float) or isinstance(p[2], int))
    665             ):
--> 666                 values = interp_value_3d(*args)
    667             else:
    668                 b = np.broadcast(*p)

/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py in _compile_for_args()
    394         # call any initialisation required for the compilation chain (e.g.
    395         # extension point registration).
--> 396         self._compilation_chain_init_hook()
    397 
    398         def error_rewrite(e, issue_type):

/opt/anaconda3/lib/python3.8/site-packages/numba/core/dispatcher.py in _compilation_chain_init_hook()
    287         before it does anything.
    288         """
--> 289         entrypoints.init_all()
    290 
    291     def _reset_overloads(self):

/opt/anaconda3/lib/python3.8/site-packages/numba/core/entrypoints.py in init_all()
     46             logger.debug('Extension loading failed for: %s', entry_point)
     47 
---> 48     eps = importlib_metadata.entry_points()
     49     # Split, Python 3.10+ and importlib_metadata 3.6+ have the "selectable"
     50     # interface, versions prior to that do not. See "compatibility note" in:

/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py in entry_points()
    854         dist.entry_points for dist in _unique(distributions())
    855     )
--> 856     return EntryPoints(eps).select(**params)
    857 
    858 

/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py in <genexpr>()
    851     :return: EntryPoints for all installed packages.
    852     """
--> 853     eps = itertools.chain.from_iterable(
    854         dist.entry_points for dist in _unique(distributions())
    855     )

/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_itertools.py in unique_everseen()
     14     else:
     15         for element in iterable:
---> 16             k = key(element)
     17             if k not in seen:
     18                 seen_add(k)

/opt/anaconda3/lib/python3.8/site-packages/importlib_metadata/_py39compat.py in normalized_name()
     16     """
     17     try:
---> 18         return dist._normalized_name
     19     except AttributeError:
     20         from . import Prepared  # -> delay to prevent circular imports.

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py in _normalized_name()
    776         return (
    777             pass_none(Prepared.normalize)(self._name_from_stem(stem))
--> 778             or super()._normalized_name
    779         )
    780 

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py in _normalized_name()
    443     def _normalized_name(self):
    444         """Return a normalized version of the name."""
--> 445         return Prepared.normalize(self.name)
    446 
    447     @property

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py in name()
    438     def name(self):
    439         """Return the 'Name' metadata for the distribution package."""
--> 440         return self.metadata['Name']
    441 
    442     @property

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py in metadata()
    427         text = (
    428             self.read_text('METADATA')
--> 429             or self.read_text('PKG-INFO')
    430             # This last clause is here to support old egg-info files.  Its
    431             # effect is to just end up using the PathDistribution's self._path

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py in read_text()
    760             PermissionError,
    761         ):
--> 762             return self._path.joinpath(filename).read_text(encoding='utf-8')
    763 
    764     read_text.__doc__ = Distribution.read_text.__doc__

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py in read_text()
    280 
    281     def read_text(self, *args, **kwargs):
--> 282         with self.open('r', *args, **kwargs) as strm:
    283             return strm.read()
    284 

/opt/anaconda3/lib/python3.8/site-packages/setuptools/_vendor/zipp.py in open()
    252         if not self.exists() and zip_mode == 'r':
    253             raise FileNotFoundError(self)
--> 254         stream = self.root.open(self.at, zip_mode, pwd=pwd)
    255         if 'b' in mode:
    256             if args or kwargs:

/opt/anaconda3/lib/python3.8/zipfile.py in open()
   1533             fheader = struct.unpack(structFileHeader, fheader)
   1534             if fheader[_FH_SIGNATURE] != stringFileHeader:
-> 1535                 raise BadZipFile("Bad magic number for file header")
   1536 
   1537             fname = zef_file.read(fheader[_FH_FILENAME_LENGTH])

BadZipFile: Bad magic number for file header

I have tried updating to v1.0.9, updating all of the dependencies referenced above, and removing the .pyc files in pycache, but none of those have had any effect. I haven't been able to figure out what zip file is the source of the error. Can you help me understand where this error is originating? Thanks!

jvines commented 1 year ago

What pandas version are you using?

jsimonastro commented 1 year ago

1.3.1

jvines commented 1 year ago

Did you try creating a fresh environment and installing there?

I think the problem might be with isochrones or numba. This is because the last module to be called before the spiral into chaos was isochrones when interpolating, and isochrones uses numba (if I remember correctly...) under the hood.

The error is most likely being caused because of some corrupted temp file or something from isochrones

jsimonastro commented 1 year ago

I'm trying this now, but haven't done it before. I defined a new environment called ariadne_environment, activated that environment, and then ran "pip install astroARIADNE". But it says it's already installed, so I must be doing something wrong.

I updated both isochrones and numba before posting the issue, and that didn't seem to change the error sequence.

jvines commented 1 year ago

What are you using to manage environments?

If you're using conda I could help you out

jsimonastro commented 1 year ago

Yes, I'm using conda.

jvines commented 1 year ago

so, usually the instructions are conda create -n name python=version

I assume you did so already so to activate the environment you go conda activate name to switch to that environment. The terminal should display something like this:

(ariadne)  jayvains@Joses-MacBook-Pro ...

since my environment for developing ariadne is called ariadne.

If that's done then you should be installing stuff to that environment. If even then pip says you've already installed something, then pip is probably not installing to the anaconda path, in which case you should check that.

You can test out the new environment by opening a python terminal and trying to import ariadne. It should fail

jsimonastro commented 1 year ago

I've created and activated the environment, but pip install still says that ariadne is already installed, and I can import ariadne in python.

jvines commented 1 year ago

Then, as I said, pip is probably not installing packages in the environment but instead at default. You should check your PATH variable and everything related to that.

I can't help you with that.

jsimonastro commented 1 year ago

I used "pip install --target /opt/anaconda3/envs/ariadne_environment/" to install ariadne and all of the dependencies to the new environment. However, when I start python and import ariadne, it still uses the original installation (/opt/anaconda3/lib/python3.8/site-packages/astroARIADNE) even though I'm in the new environment. If I remove /opt/anaconda3/bin so that the only anaconda reference in my path is /opt/anaconda3/envs/ariadne_environment/bin, the same thing happens. Do you have any advice for what should be in my path to direct python to the correct installation/environment?

jvines commented 1 year ago

I can share my PATH variable, maybe it could help you figure out what's going on. Though anaconda should automatically change stuff up

/Users/jayvains/.rvm/gems/ruby-3.0.0/bin:/Users/jayvains/.rvm/gems/ruby-3.0.0@global/bin:/Users/jayvains/.rvm/rubies/ruby-3.0.0/bin:/Users/jayvains/bin:/usr/local/bin:/Users/jayvains/opt/anaconda3/envs/ariadne/bin:/Users/jayvains/opt/anaconda3/condabin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jayvains/.rvm/bin

In that example you can see /Users/jayvains/opt/anaconda3/envs/ariadne/bin because I'm already in that environment, so something like that should pop up.

Also executing which python in the terminal should output something like this: /Users/jayvains/opt/anaconda3/envs/ariadne/bin/python

jsimonastro commented 1 year ago

Ok, I've got it working now. The problem was that I created the new environment with nothing in it. I then tried using pip to install everything needed for ariadne, but since that environment didn't have pip in it, it was using the pip from my main conda, which wasn't putting things in the right place. So instead, I used conda install to put some of the basics (python, pip, etc.) into the new environment. Then I was able to use the new pip to install ariadne and its remaining dependencies into /opt/anaconda3/envs/ariadne_environment/lib/python3.1/site-packages/ without having to adjust my path or any target directories by hand.

This sidesteps the original issue that I raised, but it's still not clear what the incompatibility was or how it arose!

jvines commented 1 year ago

If that solved the issue, then my first impression was correct: There were some corrupted temporal files. They could've been from ARIADNE, but the part that raised the error was isochrones during the interpolation.

You could try to look into the issue further by actually debugging the code, but that would be 100% up to you. As far as I'm concerned the issue is solved.

If you need anything else, don't hesitate to ask.