lecture-python-advanced.myst icon indicating copy to clipboard operation
lecture-python-advanced.myst copied to clipboard

[interpolation] Package is outdated and cannot install

Open mmcky opened this issue 4 months ago • 2 comments

The interpolation package needs to be updated

Traceback (most recent call last):
  File "<python-input-0>", line 4, in <module>
    from interpolation.splines import eval_linear, UCGrid, nodes
  File "/Users/mmcky/anaconda3/envs/qe/lib/python3.13/site-packages/interpolation/splines/__init__.py", line 3, in <module>
    from .eval_splines import options, eval_linear, eval_cubic, eval_spline
  File "/Users/mmcky/anaconda3/envs/qe/lib/python3.13/site-packages/interpolation/splines/eval_splines.py", line 6, in <module>
    from .codegen import get_code_spline, source_to_function
  File "/Users/mmcky/anaconda3/envs/qe/lib/python3.13/site-packages/interpolation/splines/codegen.py", line 1, in <module>
    from .. import tempita
  File "/Users/mmcky/anaconda3/envs/qe/lib/python3.13/site-packages/interpolation/tempita/__init__.py", line 34, in <module>
    import cgi
ModuleNotFoundError: No module named 'cgi'

to install the the latest environment.

We have previously discussed reducing our dependencies and moving some of this functionality into quantecon.py

mmcky avatar Aug 06 '25 00:08 mmcky

@mmcky The interpolation was used mainly because it provides numba jitted linear interpolation. That is now also provided by np.interp, in the sense that numba can compile this function.

A first step is to find all instances where interpolation` is used for one-dimensional linear interpolation and replace them with np.interp.

A second option is to rewrite the given lecture using JAX.

jstac avatar Aug 06 '25 00:08 jstac

Thanks @jstac

Step 1:

  • [ ] remove dependency on interpolation and replace with np.interp (as compatible with numba jit)

Step 2:

  • [ ] update lecture to use the jax library

mmcky avatar Aug 06 '25 00:08 mmcky