commonsense / conceptnet5

Code for building ConceptNet from raw data.
Other
2.76k stars 352 forks source link

limiter fails #317

Open tae898 opened 2 years ago

tae898 commented 2 years ago

I'm currently testing the master branch. When I start api.py, below error message appears.

Traceback (most recent call last):
  File "conceptnet_web/api.py", line 40, in <module>
    limiter = Limiter(app, global_limits=["600 per minute", "6000 per hour"])
  File "/usr/local/lib/python3.7/site-packages/flask_limiter/extension.py", line 153, in __init__
    assert key_func
AssertionError
amirouche commented 2 years ago

What is the actual version of flask_limiter, check out with pip freeze | grep flask-limiter.

re flask limiter: https://github.com/commonsense/conceptnet5/issues/308

tae898 commented 2 years ago

These are the versions

Flask==2.0.2
Flask-Cors==3.0.10
Flask-Limiter==2.0.2
tae898 commented 2 years ago

@amirouche I've made a PR:

https://github.com/commonsense/conceptnet5/pull/318

tae898 commented 2 years ago

Flask-Limiter==2.0.2 was released 2 days ago:

https://pypi.org/project/Flask-Limiter/

basels commented 2 years ago

You can use the latest Flask-Limiter but it requires the following changes in file conceptnet_web/api.py: [add to imports] from flask_limiter.util import get_remote_address [change line 41 to -->] limiter = Limiter(app, key_func=get_remote_address, default_limits=["600 per minute", "6000 per hour"])

tae898 commented 2 years ago

@basels

Thanks for the heads-up! I just froze the version in my docker implementation:

https://github.com/tae898/conceptnet5/blob/develop/web/setup.py:

install_requires=[
    'conceptnet >= %s' % version_str,
    'limits', 'flask >= 2.0.2', 'flask-cors >=3.0.10', 'flask-limiter == 2.0.2',
    'langcodes >= 2.1', 'jinja2-highlight', 'pygments', 'raven[flask] >= 6.6'
],
license = 'Apache License 2.0',

and https://github.com/tae898/conceptnet5/blob/master/Dockerfile

RUN git clone --single-branch --branch develop https://github.com/tae898/conceptnet5.git

It works atm.