-
Notifications
You must be signed in to change notification settings - Fork 578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cog and Pydantic v2 #2110
Comments
Could you share your $ pip install pydantic==2.6.1
Collecting pydantic==2.6.1
Downloading pydantic-2.6.1-py3-none-any.whl.metadata (83 kB)
Requirement already satisfied: annotated-types>=0.4.0 in ./lib/python3.12/site-packages (from pydantic==2.6.1) (0.7.0)
Collecting pydantic-core==2.16.2 (from pydantic==2.6.1)
Downloading pydantic_core-2.16.2-cp312-cp312-macosx_11_0_arm64.whl.metadata (6.5 kB)
Requirement already satisfied: typing-extensions>=4.6.1 in ./lib/python3.12/site-packages (from pydantic==2.6.1) (4.12.2)
Downloading pydantic-2.6.1-py3-none-any.whl (394 kB)
Downloading pydantic_core-2.16.2-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 20.8 MB/s eta 0:00:00
Installing collected packages: pydantic-core, pydantic
Attempting uninstall: pydantic-core
Found existing installation: pydantic_core 2.1.2
Uninstalling pydantic_core-2.1.2:
Successfully uninstalled pydantic_core-2.1.2
Attempting uninstall: pydantic
Found existing installation: pydantic 2.0.2
Uninstalling pydantic-2.0.2:
Successfully uninstalled pydantic-2.0.2
Successfully installed pydantic-2.6.1 pydantic-core-2.16.2
[notice] A new release of pip is available: 24.2 -> 24.3.1
[notice] To update, run: pip install --upgrade pip
$ python
Python 3.12.7 (main, Oct 1 2024, 02:05:46) [Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pydantic import TypeAdapter
>>> print("OK")
OK |
Thank you for your answer build:
gpu: false
python_version: "3.12"
python_packages:
- "syrius-sdk"
- "boto3"
predict: "predict.py:Predictor" the cog file is very simple |
If you're right that the $ pkginfo -f requires_dist syrius_sdk-0.2.60-py3-none-any.whl
requires_dist: ['pydantic', 'httpx', 'black; extra == "dev"', 'bumpver; extra == "dev"', 'isort; extra == "dev"', 'pip-tools; extra == "dev"', 'pytest; extra == "dev"'] As you can see, it declares a dependency on In order to get build:
gpu: false
python_version: "3.12"
python_packages:
- "syrius-sdk"
- "boto3"
- "fastapi>0.100.0,<0.111.0"
- "pydantic>2"
predict: "predict.py:Predictor" You need to specify |
I also opened #2112 to track one part of this on our side. |
Thank you so much!!! This solution work!!!
|
I need to use a library that have as requirement pydantic 2.6.1 and cog return:
Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/cog/server/worker.py", line 435, in _load_predictor return load_predictor_from_ref(self._predictor_ref) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/cog/server/runner.py", line 229, in _handle_done f.result() File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception cog.server.exceptions.FatalWorkerException: Predictor errored during setup: cannot import name 'TypeAdapter' from 'pydantic' (/usr/local/lib/python3.12/site-packages/pydantic/__init__.cpython-312-x86_64-linux-gnu.so)
I'vfe seen that have more issues related with that problem but i've not seen any solution
The text was updated successfully, but these errors were encountered: