pykep icon indicating copy to clipboard operation
pykep copied to clipboard

Dependency incompatibility with automated conda installation

Open afossa opened this issue 1 year ago • 1 comments

pykep is incompatible with the newly released SciPy 1.14.0 since interp2d has been deprecated by the latter. See the release notes.

However, creating a new conda environment with

micromamba env create -n myenv -c conda-forge pykep

installs the latest release of SciPy, which causes this error when trying to import pykep:

Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:36:13) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pykep
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/workspace/programs/micromamba/envs/kep/lib/python3.11/site-packages/pykep/__init__.py", line 56, in <module>
    from pykep import core, sims_flanagan, pontryagin, orbit_plots, examples, phasing, util, planet, trajopt
  File "/workspace/programs/micromamba/envs/kep/lib/python3.11/site-packages/pykep/trajopt/__init__.py", line 15, in <module>
    launchers = _launchers()
                ^^^^^^^^^^^^
  File "/workspace/programs/micromamba/envs/kep/lib/python3.11/site-packages/pykep/trajopt/_launchers.py", line 95, in __init__
    self._atlas501 = interp2d(_vinfs_A5, _decls_A5, _data_A5, kind='linear', fill_value=0.1, copy=False)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/programs/micromamba/envs/kep/lib/python3.11/site-packages/scipy/interpolate/_interpolate.py", line 129, in __init__
    raise NotImplementedError(err_mesg)
NotImplementedError: `interp2d` has been removed in SciPy 1.14.0.

For legacy code, nearly bug-for-bug compatible replacements are
`RectBivariateSpline` on regular grids, and `bisplrep`/`bisplev` for
scattered 2D data.

In new code, for regular grids use `RegularGridInterpolator` instead.
For scattered data, prefer `LinearNDInterpolator` or
`CloughTocher2DInterpolator`.

For more details see
https://scipy.github.io/devdocs/tutorial/interpolate/interp_transition_guide.html

forcing a downgrade to SciPy 1.13.1 solves the issue.

afossa avatar Jul 11 '24 17:07 afossa

Thank you for the report, indeed you are right and Future versions of pykep will solve this, but are scheduled in a few months. We are currently developing pykep 3.0 and do not have the bandwith to fix this issue on the current code base. A PR is welcome, in case.

darioizzo avatar Jul 14 '24 10:07 darioizzo