Skip to content
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

PydanticImportError: pydantic.utils:ValueItems has been removed in V2. #146

Open
sakkyoi opened this issue Jul 14, 2023 · 2 comments
Open

Comments

@sakkyoi
Copy link

sakkyoi commented Jul 14, 2023

Shioaji version

1.1.6

Python version

3.10.2

Issue

PydanticImportError: pydantic.utils:ValueItems has been removed in V2. occurred while importing shioaji.

Error details

---------------------------------------------------------------------------
PydanticImportError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 import shioaji as sj
      2 from dotenv import load_dotenv
      3 import os

File [...\.venv\lib\site-packages\shioaji\__init__.py:29](file:///.../.venv/lib/site-packages/shioaji/__init__.py:29)
     26 inject_libpath()
     27 del inject_libpath
---> 29 from shioaji.shioaji import Shioaji
     30 from shioaji.constant import Exchange
     31 from shioaji.account import Account

File [...\.venv\lib\site-packages\shioaji\shioaji.py:6](file:///.../.venv/lib/site-packages/shioaji/shioaji.py:6)
      3 import datetime as dt
      4 from sentry_sdk import configure_scope
----> 6 from shioaji.account import Account, AccountType, FutureAccount, StockAccount
      7 from shioaji.backend.solace.utils import (
      8     get_contracts_filename,
      9     load_contracts_file,
     10     mockca,
     11     new_contracts,
     12 )
     13 from shioaji.backend.utils import create_solace
...
    287 if name in globals:

PydanticImportError: `pydantic.utils:ValueItems` has been removed in V2.

For further information visit https://errors.pydantic.dev/2.0.2/u/import-error
@sakkyoi
Copy link
Author

sakkyoi commented Jul 14, 2023

It's not shioaji's problem. can fix by reinstall pydantic version 1.10.11:

pip uninstall pydantic
pip install pydantic==1.10.11

@sakkyoi sakkyoi closed this as completed Jul 14, 2023
@sakkyoi
Copy link
Author

sakkyoi commented Jul 14, 2023

pydantic in the requires-dist of shioaji must have version requires or this error will occur when every new installation.
(the latest version of pydantic is 2.0.2. error will occur if pydantic >= v2)

@sakkyoi sakkyoi reopened this Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant