Immutable solution version
Error "cannot import name 'TypeAliasType' from 'typing_extensions'" when importing openai just after installation
Complete solution
[Marwen94 (commenter)]: The TypeAliasType import error when importing openai comes from a typing_extensions/pydantic version mismatch. Confirmed workarounds: pin pydantic==1.10.11 with typing_extensions==4.7.0, or upgrade to pydantic>=2.5.0 with typing_extensions>=4.6.0 and restart the kernel.
What was reported: Issue openai/openai-python#816 (closed, 21 comments): ### Confirm this is an issue with the Python library and not an underlying OpenAI API
- [X] This is an issue with the Python library
Describe the bug
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[38], line 1
----> 1 import openai
2 import os
4 opai.api_key value [redacted]
File D:\Anaconda\envs\py38\lib\site-packages\openai\__init__.py:8
5 import os as _os
6 from typing_extensions import override
----> 8 from . import types
9...
What works:
[Marwen94 (commenter)]: The TypeAliasType import error when importing openai comes from a typing_extensions/pydantic version mismatch. Confirmed workarounds: pin pydantic==1.10.11 with typing_extensions==4.7.0, or upgrade to pydantic>=2.5.0 with typing_extensions>=4.6.0 and restart the kernel.Evidence
In the GitHub issue, the reporter asked: Error "cannot import name 'TypeAliasType' from 'typingextensions'" when importing openai just after installation. The working answer that came out of the thread: [Marwen94 (commenter)]: The TypeAliasType import error when importing openai comes from a typingextensions/pydantic version mismatch. Confirmed workarounds: pin pydantic==1.10.11 with typingextensions==4.7.0, or upgrade to pydantic>=2.5.0 with typingextensions>=4.6.0 and restart the kernel. Source: https://github.com/openai/openai-python/issues/816
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_liAaEcyoV-ib95tYgjeYzQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Error "cannot import name 'TypeAliasType' from 'typing_extensions'" when importing openai just after installation <span>— Vectle</span></a>