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
I have searched both the documentation and discord for an answer.
Question
Hello,
I got the following import error when importing as follows:
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/init.py:16
13 pass
15 # response
---> 16 from llama_index.core.base.response.schema import Response
18 # import global eval handler
19 from llama_index.core.callbacks.global_handlers import set_global_handler
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/base/response/schema.py:7
4 from dataclasses import dataclass, field
5 from typing import Any, Dict, List, Optional, Union
----> 7 from llama_index.core.async_utils import asyncio_run
8 from llama_index.core.bridge.pydantic import BaseModel
9 from llama_index.core.schema import NodeWithScore
ImportError: cannot import name 'BeforeValidator' from 'pydantic' (/home2/xxx/.local/lib/python3.10/site-packages/pydantic/init.cpython-310-x86_64-linux-gnu.so)
I tried both pydantic 2.10 (newest version) and older 1.10. What version of pydantic is used in Llama-index, which is using BeforeValidator?
Thank you,
The text was updated successfully, but these errors were encountered:
Hi Logan,
Earlier I used mamba install llama-index, which installed pydantic 2.10.3 and led to the import error.
Just now I tried pip install llama-index, which installed 2.10.4 and works now:-)
Thanks!
Question Validation
Question
Hello,
I got the following import error when importing as follows:
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/init.py:16
13 pass
15 # response
---> 16 from llama_index.core.base.response.schema import Response
18 # import global eval handler
19 from llama_index.core.callbacks.global_handlers import set_global_handler
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/base/response/schema.py:7
4 from dataclasses import dataclass, field
5 from typing import Any, Dict, List, Optional, Union
----> 7 from llama_index.core.async_utils import asyncio_run
8 from llama_index.core.bridge.pydantic import BaseModel
9 from llama_index.core.schema import NodeWithScore
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/async_utils.py:7
4 from itertools import zip_longest
5 from typing import Any, Coroutine, Iterable, List, Optional, TypeVar
----> 7 import llama_index.core.instrumentation as instrument
9 dispatcher = instrument.get_dispatcher(name)
12 def asyncio_module(show_progress: bool = False) -> Any:
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/instrumentation/init.py:5
2 from abc import ABC
3 from typing import Any, List
----> 5 from llama_index.core.instrumentation.dispatcher import (
6 Dispatcher,
7 Manager,
8 DISPATCHER_SPAN_DECORATED_ATTR,
9 )
10 from llama_index.core.instrumentation.event_handlers import NullEventHandler
11 from llama_index.core.instrumentation.span_handlers import NullSpanHandler
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/instrumentation/dispatcher.py:10
8 import uuid
9 from deprecated import deprecated
---> 10 from llama_index.core.bridge.pydantic import BaseModel, Field, ConfigDict
11 from llama_index.core.instrumentation.event_handlers import BaseEventHandler
12 from llama_index.core.instrumentation.span import active_span_id
File ~/pro/mambaforge/envs/env_cuda121c/lib/python3.10/site-packages/llama_index/core/bridge/pydantic.py:2
1 import pydantic
----> 2 from pydantic import (
3 AnyUrl,
4 BaseModel,
5 BeforeValidator,
6 ConfigDict,
7 Field,
8 FilePath,
9 GetCoreSchemaHandler,
10 GetJsonSchemaHandler,
11 PlainSerializer,
12 PrivateAttr,
13 Secret,
14 SecretStr,
15 SerializeAsAny,
16 StrictFloat,
17 StrictInt,
18 StrictStr,
19 TypeAdapter,
20 ValidationError,
21 ValidationInfo,
22 WithJsonSchema,
23 WrapSerializer,
24 create_model,
25 field_serializer,
26 field_validator,
27 model_serializer,
28 model_validator,
29 )
30 from pydantic.fields import FieldInfo
31 from pydantic.json_schema import JsonSchemaValue
ImportError: cannot import name 'BeforeValidator' from 'pydantic' (/home2/xxx/.local/lib/python3.10/site-packages/pydantic/init.cpython-310-x86_64-linux-gnu.so)
I tried both pydantic 2.10 (newest version) and older 1.10. What version of pydantic is used in Llama-index, which is using BeforeValidator?
Thank you,
The text was updated successfully, but these errors were encountered: