cog icon indicating copy to clipboard operation
cog copied to clipboard

build hangs on 'Validating model schema...'

Open happy-machine opened this issue 1 year ago • 4 comments

With no other feedback?

Thanks

happy-machine avatar Oct 11 '23 11:10 happy-machine

Seems related, I am getting this:

Traceback (most recent call last): File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/command/openapi_schema.py", line 10, in from ..server.http import create_app File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/server/http.py", line 21, in from pydantic.error_wrappers import ErrorWrapper File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pydantic/_migration.py", line 300, in wrapper raise PydanticImportError(f'{import_path} has been removed in V2.') pydantic.errors.PydanticImportError: pydantic.error_wrappers:ErrorWrapper has been removed in V2.

For further information visit https://errors.pydantic.dev/2.4/u/import-error

ⅹ Failed to get type signature: exit status 1

rdcoder33 avatar Oct 13 '23 13:10 rdcoder33

`Validating model schema...

Traceback (most recent call last): File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/root/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/command/openapi_schema.py", line 10, in from ..server.http import create_app File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/server/http.py", line 16, in from fastapi import Body, FastAPI, Header, HTTPException, Path, Response File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/init.py", line 7, in from .applications import FastAPI as FastAPI File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/applications.py", line 16, in from fastapi import routing File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/routing.py", line 22, in from fastapi import params File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/fastapi/params.py", line 4, in from pydantic.fields import FieldInfo, Undefined ImportError: cannot import name 'Undefined' from 'pydantic.fields' (/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pydantic/fields.py)`

I am getting this. I am new to cog, I do not see the .pyenv folder in root

Sanawar21 avatar Nov 01 '23 14:11 Sanawar21

@happy-machine This step tries to import your predict.py, but doesn't run any setup or prediction functions. Are you doing anything time-consuming in predict.py?

@rdcoder33 @Sanawar21 currently, cog doesn't support pydantic>=2.0.0. You'll get this error if you use it in your requirements.txt

yorickvP avatar Nov 22 '23 16:11 yorickvP

Ah yea this error just came up for me today too. Here's a quick workaround...in cog.yaml just add a line in the run section that downgrades pydantic.

  run:
    # ...
    - pip install "pydantic<2.0.0"

Of course this could be done in the python_packages section but in my case pydantic gets installed in the run as some dependency of something I installed there. So this would fix the issue either way (and avoids rebuilding the whole image at the cost of a slightly bigger image size, since each run command is cached separately).

nateraw avatar Feb 02 '24 20:02 nateraw