unilm icon indicating copy to clipboard operation
unilm copied to clipboard

ImportError: cannot import name 'MultiHostDsn' from 'pydantic.networks' (/opt/conda/lib/python3.8/site-packages/pydantic/networks.cpython-38-x86_64-linux-gnu.so)

Open xiaohui-li1 opened this issue 1 year ago • 6 comments

I followed the setup step by step, but got this Error when I am doing the last step(i.e. bash run_gradio.sh).Can you please help me to solve this problem? I really want to deploy Kosmos-2 locally. Many thanks ! File "/opt/conda/lib/python3.8/site-packages/fastapi/_compat.py", line 297, in from pydantic.networks import ( # type: ignore[no-redef]

ImportError: cannot import name 'MultiHostDsn' from 'pydantic.networks' (/opt/conda/lib/python3.8/site-packages/pydantic/networks.cpython-38-x86_64-linux-gnu.so)

ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 7738) of binary: /opt/conda/bin/python Traceback (most recent call last): File "/opt/conda/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/opt/conda/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/opt/conda/lib/python3.8/site-packages/torch/distributed/launch.py", line 195, in main() File "/opt/conda/lib/python3.8/site-packages/torch/distributed/launch.py", line 191, in main launch(args) File "/opt/conda/lib/python3.8/site-packages/torch/distributed/launch.py", line 176, in launch run(args) File "/opt/conda/lib/python3.8/site-packages/torch/distributed/run.py", line 753, in run elastic_launch( File "/opt/conda/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 132, in call return launch_agent(self._config, self._entrypoint, list(args)) File "/opt/conda/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 246, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

demo/gradio_app.py FAILED

Failures: <NO_OTHER_FAILURES>

Root Cause (first observed failure): [0]: time : 2023-07-09_04:02:58 host : 62e0ebebfeae rank : 0 (local_rank: 0) exitcode : 1 (pid: 7738) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html

xiaohui-li1 avatar Jul 09 '23 04:07 xiaohui-li1

Hi, you can try:

pip install --upgrade --user pydantic

pengzhiliang avatar Jul 09 '23 10:07 pengzhiliang

@pengzhiliang tried that and it caused the following error: thinc 8.0.13 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 2.0.2 which is incompatible. spacy 3.2.2 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 2.0.2 which is incompatible.

Tried installing pydantic==1.7.4 but received the same error as the first post

katsully avatar Jul 09 '23 21:07 katsully

Tried installing pydantic==1.8.2 but didn't work either.

JierunChen avatar Jul 10 '23 06:07 JierunChen

After running pip install --upgrade --user pydantic I got the following error: thinc 8.0.13 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 2.0.2 which is incompatible. spacy 3.2.2 requires pydantic!=1.8,!=1.8.1,<1.9.0,>=1.7.4, but you have pydantic 2.0.2 which is incompatible.

However, I am able to run the file gradio_app.py.

JierunChen avatar Jul 10 '23 06:07 JierunChen

Yes, we are also trying to solve the problem of version conflict.

pengzhiliang avatar Jul 10 '23 09:07 pengzhiliang

Found the magical combination of python library versions spacy==3.6.0 thinc==8.1.10 pydantic==1.10.10

katsully avatar Jul 10 '23 16:07 katsully