EconForge / interpolation.py

BSD 2-Clause "Simplified" License
123 stars 35 forks source link

`curses` requirement? #97

Closed Mv77 closed 1 year ago

Mv77 commented 1 year ago

@albop, after your recent patch for the derivatives issue, installing interpolation and importing splines results in the following error on Windows:

HARK\econforgeinterp.py:2: in <module>
    from interpolation.splines import eval_linear, eval_spline, CGrid
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\interpolation\splines\__init__.py:1: in <module>
    from curses import A_ALTCHARSET
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\curses\__init__.py:13: in <module>
    from _curses import *
E   ModuleNotFoundError: No module named '_curses'

It comes from this line, which was introduced by the patch https://github.com/EconForge/interpolation.py/blob/578253472f715338c3e8b5d5032b145f2d11f781/interpolation/splines/__init__.py#L1

The issue is that curses is not included in Windows's Python installation. I don't see the import being used, could it be removed? or added to the requirements?

Sorry I did not bring this up in my checks, I ran them on a Linux machine.

albop commented 1 year ago

Ah we need to fix that. Maybe it was added by black. I'll Do that very shortly

Le sam. 6 août 2022, 20:25, Mateo Velásquez-Giraldo < @.***> a écrit :

@albop https://github.com/albop, after your recent patch for the derivatives issue, installing interpolation and importing splines results in the following error on Windows:

HARK\econforgeinterp.py:2: in from interpolation.splines import eval_linear, eval_spline, CGrid C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\interpolation\splines__init__.py:1: in from curses import A_ALTCHARSET C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\curses__init__.py:13: in from _curses import * E ModuleNotFoundError: No module named '_curses'

It comes from this line, which was introduced by the patch

https://github.com/EconForge/interpolation.py/blob/578253472f715338c3e8b5d5032b145f2d11f781/interpolation/splines/__init__.py#L1

The issue is that curses is not included in Windows's Python installation https://docs.python.org/3/howto/curses.html. I don't see the import being used, could it be removed? or added to the requirements?

Sorry I did not bring this up in my checks, I ran them on a Linux machine.

— Reply to this email directly, view it on GitHub https://github.com/EconForge/interpolation.py/issues/97, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACDSKPGKZNX3FIIUYZJNNDVX2U3HANCNFSM55ZEIPVQ . You are receiving this because you were mentioned.Message ID: @.***>

Mv77 commented 1 year ago

Thanks!

Sorry to bother you again, but I also wanted to ask, why do you require grids to have a length greater than 2? https://github.com/EconForge/interpolation.py/blob/578253472f715338c3e8b5d5032b145f2d11f781/interpolation/splines/__init__.py#L28 Would 2 points not suffice for it to work as a line?

albop commented 1 year ago

You're not bothering me at all. On the opposite!

Yes the check is useless. You need more than 2 points if you want higher order splines but it shouldn't bé a critérium satisfied by thé grid object. Plus we are not making thé check for regular grids. I'll put n>=2

Le sam. 6 août 2022, 21:28, Mateo Velásquez-Giraldo < @.***> a écrit :

Thanks!

Sorry to bother you again, but I also wanted to ask, why do you require grids to have a length greater than 2?

https://github.com/EconForge/interpolation.py/blob/578253472f715338c3e8b5d5032b145f2d11f781/interpolation/splines/__init__.py#L28 Would 2 points not suffice for it to work as a line?

— Reply to this email directly, view it on GitHub https://github.com/EconForge/interpolation.py/issues/97#issuecomment-1207270671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACDSKIYITCQZPCTBBPGADTVX24ENANCNFSM55ZEIPVQ . You are receiving this because you were mentioned.Message ID: @.***>

albop commented 1 year ago

OK, I made both fixes and pushed the result. Not clear how I added the curse dependency. I suppose my editor went overzealous...

albop commented 1 year ago

This is now on pypi.

Mv77 commented 1 year ago

Awesome!

Thank you @albop. Yeah, I've found VScode and black adding the strangest packages to my scripts lately. Weird and annoying.

But thanks for fixing it so quickly!