Open sCarita opened 7 months ago
I understood we can control the fastapi version on the cog.yaml
via python_packages
key. So I did update, but now I get a new error which seems to be related with the internals of cog using pydantic v1 related options.
Traceback (most recent call last):
File "/root/.pyenv/versions/3.10.10/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.10/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/root/.pyenv/versions/3.10.10/lib/python3.10/site-packages/cog/command/openapi_schema.py", line 10, in <module>
from ..server.http import create_app
File "/root/.pyenv/versions/3.10.10/lib/python3.10/site-packages/cog/server/http.py", line 21, in <module>
from pydantic.error_wrappers import ErrorWrapper
File "/root/.pyenv/versions/3.10.10/lib/python3.10/site-packages/pydantic/_migration.py", line 302, 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.5/u/import-error
So I am trying to understand if all cog versions use:
from pydantic.error_wrappers import ErrorWrapper @ cog/server/http.py
I am updating the source code now. to:
if request.id is not None and request.id != prediction_id:
errors = [{
'loc': ('body', 'id'),
'msg': "prediction ID must match the ID supplied in the URL",
'type': 'value_error',
}]
raise ValidationError(errors, PredictionRequest)
...
But when I am building... $ make
mkdir -p pkg/dockerfile/embed
cp dist/*.whl pkg/dockerfile/embed/cog.whl
CGO_ENABLED=0 go build -o cog \
-ldflags "-X github.com/replicate/cog/pkg/global.Version=v0.9.0-beta10+dev -X github.com/replicate/cog/pkg/global.BuildTime=2023-11-19T20:42:00+0000 -w" \
cmd/cog/cog.go
build command-line-arguments: cannot load embed: malformed module path "embed": missing dot in first path element
make: *** [Makefile:34: cog] Error 1
I was able to solve the problem by updating the golang to version 1.20 as stated in go.mod
. After it I was able to build my own cog with pydantic fixed. Had a few hiccups along the way, but it is working now.
@sCarita is there any new release or fix instructions for this, i am also getting the same error
File "/root/.pyenv/versions/3.11.8/lib/python3.11/site-packages/cog/server/http.py", line 36, in <module>
from pydantic.error_wrappers import ErrorWrapper
File "/root/.pyenv/versions/3.11.8/lib/python3.11/site-packages/pydantic/_migration.py", line 302, 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.6/u/import-error
ⅹ Failed to get container status: exit status 1
I am also using cog for push my model to replicate
but at the end of the process I got this error :
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 25, in
Traceback (most recent call last):
File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/server/http.py", line 137, in create_app
predictor = load_predictor_from_ref(predictor_ref)
File "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/cog/predictor.py", line 187, in load_predictor_from_ref
spec.loader.exec_module(module)
File "
how can i fix that problem?
I don't believe this is fixed -- re-opening.
Hello everyone,
I am building an image that needs
segments-ai
python package, which requires pydantic to be above version2.*
. The problem is that if I install the pydantic python package above version 2, I get an error during the "Validating model schema..." phase.It seems that the fastapi version used by cog is expecting pydantic to be below version 2, where "Undefined" object exists...
My current cog version is:
cog version 0.8.6 (built 2023-08-07T21:51:56Z)
Any ideas on how to workaround this are gladly accepted.
Thank you for your time.