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

[Jupyter docker] ImportError: cannot import name 'Self' from 'typing_extensions' #161

Open
gubkke opened this issue Jan 19, 2024 · 0 comments

Comments

@gubkke
Copy link

gubkke commented Jan 19, 2024

Environment:
Jupyter docker image
docker pull sinotrade/shioaji:jupyter

shioaji
Version: 1.2.2
Location: /opt/conda/lib/python3.8/site-packages

I got an error while importing shioaji

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/conda/lib/python3.8/site-packages/shioaji/__init__.py", line 29, in <module>
    from shioaji.shioaji import Shioaji
  File "/opt/conda/lib/python3.8/site-packages/shioaji/shioaji.py", line 6, in <module>
    from shioaji.account import Account, AccountType, FutureAccount, StockAccount
  File "/opt/conda/lib/python3.8/site-packages/shioaji/account.py", line 3, in <module>
    from shioaji.base import BaseModel
  File "/opt/conda/lib/python3.8/site-packages/shioaji/base.py", line 3, in <module>
    from pydantic import (
  File "/opt/conda/lib/python3.8/site-packages/pydantic/__init__.py", line 357, in <module>
    _getattr_migration = getattr_migration(__name__)
  File "/opt/conda/lib/python3.8/site-packages/pydantic/_migration.py", line 260, in getattr_migration
    from .errors import PydanticImportError
  File "/opt/conda/lib/python3.8/site-packages/pydantic/errors.py", line 6, in <module>
    from typing_extensions import Literal, Self
ImportError: cannot import name 'Self' from 'typing_extensions' (/opt/conda/lib/python3.8/site-packages/typing_extensions.py)

After updating typing_extensions then the import error is gone.
Could we also update the package in the jupyter docker image?
Or is it something wrong with my environment and it's not happened on your side?

pip install -U typing_extensions

      Successfully uninstalled typing-extensions-3.7.4.2
Successfully installed typing-extensions-4.9.0

Thanks!

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