bentoml / BentoML

The easiest way to serve AI apps and models - Build Model Inference APIs, Job queues, LLM apps, Multi-model pipelines, and much more!
https://bentoml.com
Apache License 2.0
7.12k stars 791 forks source link

bug: BentoML installation throwing mutable default <class 'bentoml.types.HTTPHeaders'> for field headers is not allowed: use default_factory #4336

Open amustafi1986 opened 10 months ago

amustafi1986 commented 10 months ago

Describe the bug

We installed BentoML 0.13.1 as we cannot migrate to 1.x at this moment, the installation is throwing the following error when we are trying to run any bentoml command: Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Scripts\bentoml.exe__main.py", line 4, in File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\init.py", line 30, in from bentoml.service import ( # noqa: E402 File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\service\init.py", line 31, in from bentoml.adapters import BaseInputAdapter, BaseOutputAdapter, DefaultOutput File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\adapters\init__.py", line 15, in from bentoml.adapters.annotated_image_input import AnnotatedImageInput File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\adapters\annotated_image_input.py", line 19, in from bentoml.adapters.multi_file_input import MultiFileInput File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\adapters\multi_file_input.py", line 18, in from bentoml.adapters.base_input import BaseInputAdapter, parse_cli_inputs File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\adapters\base_input.py", line 22, in from bentoml.types import ( File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\site-packages\bentoml\types.py", line 199, in @dataclass ^^^^^^^^^ File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1230, in dataclass return wrap(cls) ^^^^^^^^^ File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 1220, in wrap return _process_class(cls, init, repr, eq, order, unsafe_hash, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 958, in _process_class cls_fields.append(_get_field(cls, name, type, kw_only)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aritramustafi\AppData\Local\Programs\Python\Python311\Lib\dataclasses.py", line 815, in _get_field raise ValueError(f'mutable default {type(f.default)} for field ' ValueError: mutable default <class 'bentoml.types.HTTPHeaders'> for field headers is not allowed: use default_factory

To reproduce

Install BentoML Try to run any bentoml command or import any bentoml packages to python code.

Expected behavior

No response

Environment

Bentoml: 0.13.1 Python: 3.11.7 Platform: Windows 10(64 bit)

frostming commented 10 months ago

You are on an old version of bentoml, is it possible to upgrade to a new version?

amustafi1986 commented 10 months ago

Hi frostming, unfortuately we cannot upgrade to bentoml 1.x, our code is set to use 0.13.1. We are trying to set up a new server and code around the module, and we kind of have to use the version specified.