You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When use create_api function , the generate code contains non annottated attributes . Thus pydentic is unable to perform the right validations thus rendering the generated api unable to work.
When using create_api , i expect a working api , generated with fastapi and pydantic.
Actual Results
/home/huncho/MLProjects/bc_pycart_fastapi/.venv/bin/python /home/huncho/MLProjects/bc_pycart_fastapi/diabetes_api.py
Transformation Pipeline and Model Successfully Loaded
Traceback (most recent call last):
File "/home/huncho/MLProjects/bc_pycart_fastapi/diabetes_api.py", line 16, in <module>
input_model = create_model(
File "/home/huncho/MLProjects/bc_pycart_fastapi/.venv/lib/python3.10/site-packages/pydantic/main.py", line 1490, in create_modelreturn meta(
File "/home/huncho/MLProjects/bc_pycart_fastapi/.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 92, in __new__
private_attributes = inspect_namespace(
File "/home/huncho/MLProjects/bc_pycart_fastapi/.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 384, in inspect_namespaceraise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `Plasma glucose concentration a 2 hours in an oral glucose tolerance test = 152.0`. All model fields require a type annotation; if `Plasma glucose concentration a 2 hours in an oral glucose tolerance test` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
For further information visit https://errors.pydantic.dev/2.6/u/model-field-missing-annotation
(.venv) huncho@DESKTOP-1T270KV:~/MLProjects/bc_pycart_fastapi$ /home/huncho/MLProjects/bc_pycart_fastapi/.venv/bin/python /home/huncho/MLProjects/bc_pycart_fastapi/diabetes_api.py
Transformation Pipeline and Model Successfully Loaded
Traceback (most recent call last):
File "/home/huncho/MLProjects/bc_pycart_fastapi/diabetes_api.py", line 16, in <module>
input_model = create_model("diabetes_api_input", **{'Number of times pregnant': 13.0, 'Plasma glucose concentration a 2 hours in an oral glucose tolerance test': 152.0, 'Diastolic blood pressure (mm Hg)': 90.0, 'Triceps skin fold thickness (mm)': 33.0, '2-Hour serum insulin (mu U/ml)': 29.0, 'Body mass index (weight in kg/(height in m)^2)': 26.799999237060547, 'Diabetes pedigree function': 0.7310000061988831, 'Age (years)': 43.0})
File "/home/huncho/MLProjects/bc_pycart_fastapi/.venv/lib/python3.10/site-packages/pydantic/main.py", line 1490, in create_modelreturn meta(
File "/home/huncho/MLProjects/bc_pycart_fastapi/.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 92, in __new__
private_attributes = inspect_namespace(
File "/home/huncho/MLProjects/bc_pycart_fastapi/.venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.py", line 384, in inspect_namespaceraise PydanticUserError(
pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `Number of times pregnant = 13.0`. All model fields require a type annotation; if `Number of times pregnant` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
For further information visit https://errors.pydantic.dev/2.6/u/model-field-missing-annotation
PyCaret optional dependencies:
shap: Not installed
interpret: Not installed
umap: Not installed
ydata_profiling: Not installed
explainerdashboard: Not installed
autoviz: Not installed
fairlearn: Not installed
deepchecks: Not installed
xgboost: Not installed
catboost: Not installed
kmodes: Not installed
mlxtend: Not installed
statsforecast: Not installed
tune_sklearn: Not installed
ray: Not installed
hyperopt: Not installed
optuna: Not installed
skopt: Not installed
mlflow: Not installed
gradio: Not installed
fastapi: 0.110.0
uvicorn: 0.28.0
m2cgen: Not installed
evidently: Not installed
fugue: Not installed
streamlit: Not installed
prophet: Not installed
The text was updated successfully, but these errors were encountered:
pydantic is not a direct dependency on pycaret. Try manually installing an older version of pydantic. If you can, please tell me which version worked, so I can propose that Pycaret itself does version control in the dependency list.
pycaret version checks
I have checked that this issue has not already been reported here.
I have confirmed this bug exists on the latest version of pycaret.
I have confirmed this bug exists on the master branch of pycaret (pip install -U git+https://github.com/pycaret/pycaret.git@master).
Issue Description
When use create_api function , the generate code contains non annottated attributes . Thus pydentic is unable to perform the right validations thus rendering the generated api unable to work.
Reproducible Example
Expected Behavior
When using create_api , i expect a working api , generated with fastapi and pydantic.
Actual Results
Installed Versions
System:
python: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
executable: /home/huncho/MLProjects/bc_pycart_fastapi/.venv/bin/python
machine: Linux-5.15.146.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
PyCaret required dependencies:
pip: 22.0.2
setuptools: 59.6.0
pycaret: 3.3.0
IPython: 8.22.2
ipywidgets: 8.1.2
tqdm: 4.66.2
numpy: 1.26.4
pandas: 2.1.4
jinja2: 3.1.3
scipy: 1.11.4
joblib: 1.3.2
sklearn: 1.4.1.post1
pyod: 1.1.3
imblearn: 0.12.0
category_encoders: 2.6.3
lightgbm: 4.3.0
numba: 0.59.0
requests: 2.31.0
matplotlib: 3.7.5
scikitplot: 0.3.7
yellowbrick: 1.5
plotly: 5.20.0
plotly-resampler: Not installed
kaleido: 0.2.1
schemdraw: 0.15
statsmodels: 0.14.1
sktime: 0.27.0
tbats: 1.1.3
pmdarima: 2.0.4
psutil: 5.9.8
markupsafe: 2.1.5
pickle5: Not installed
cloudpickle: 3.0.0
deprecation: 2.1.0
xxhash: 3.4.1
wurlitzer: 3.0.3
PyCaret optional dependencies:
shap: Not installed
interpret: Not installed
umap: Not installed
ydata_profiling: Not installed
explainerdashboard: Not installed
autoviz: Not installed
fairlearn: Not installed
deepchecks: Not installed
xgboost: Not installed
catboost: Not installed
kmodes: Not installed
mlxtend: Not installed
statsforecast: Not installed
tune_sklearn: Not installed
ray: Not installed
hyperopt: Not installed
optuna: Not installed
skopt: Not installed
mlflow: Not installed
gradio: Not installed
fastapi: 0.110.0
uvicorn: 0.28.0
m2cgen: Not installed
evidently: Not installed
fugue: Not installed
streamlit: Not installed
prophet: Not installed
The text was updated successfully, but these errors were encountered: