diff --git a/cornac/serving/app.py b/cornac/serving/app.py index 6b4076616..f55721da5 100644 --- a/cornac/serving/app.py +++ b/cornac/serving/app.py @@ -17,9 +17,16 @@ import os import pickle -from flask import Flask, jsonify, request from csv import writer +try: + from flask import Flask, jsonify, request +except ImportError: + exit( + "Flask is required in order to serve models.\n" + + "Run: pip3 install Flask" + ) + def _import_model_class(model_class): components = model_class.split(".") diff --git a/setup.py b/setup.py index 22492c12d..d81bc3d2f 100644 --- a/setup.py +++ b/setup.py @@ -308,7 +308,7 @@ def extract_gcc_binaries(): "recommendation", ], ext_modules=extensions, - install_requires=["numpy", "scipy", "tqdm>=4.19", "powerlaw", "Flask>=3.0.0"], + install_requires=["numpy", "scipy", "tqdm>=4.19", "powerlaw"], extras_require={"tests": ["pytest", "pytest-pep8", "pytest-xdist", "pytest-cov"]}, cmdclass=cmdclass, packages=find_packages(),