jupyter-lab启动提示TypeError: Plain typing_extensions.Self is not valid as type argument

jupyter-lab启动提示TypeError: Plain typing_extensions.Self is not valid as type argument

$ jupyter-lab
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-lab", line 5, in <module>
    from jupyterlab.labapp import main
  File "/usr/local/lib/python3.9/dist-packages/jupyterlab/labapp.py", line 45, in <module>
    from .extensions import MANAGERS as EXT_MANAGERS
  File "/usr/local/lib/python3.9/dist-packages/jupyterlab/extensions/__init__.py", line 12, in <module>
    from .pypi import PyPIExtensionManager
  File "/usr/local/lib/python3.9/dist-packages/jupyterlab/extensions/pypi.py", line 23, in <module>
    from async_lru import alru_cache
  File "/usr/local/lib/python3.9/dist-packages/async_lru/__init__.py", line 64, in <module>
    class _LRUCacheWrapper(Generic[_R]):
  File "/usr/local/lib/python3.9/dist-packages/async_lru/__init__.py", line 231, in _LRUCacheWrapper
    ) -> Union[Self, "_LRUCacheWrapperInstanceMethod[_R, _T]"]:
  File "/usr/lib/python3.9/typing.py", line 268, in inner
    return func(*args, **kwds)
  File "/usr/lib/python3.9/typing.py", line 345, in __getitem__
    return self._getitem(self, parameters)
  File "/usr/lib/python3.9/typing.py", line 456, in Union
    parameters = tuple(_type_check(p, msg) for p in parameters)
  File "/usr/lib/python3.9/typing.py", line 456, in <genexpr>
    parameters = tuple(_type_check(p, msg) for p in parameters)
  File "/usr/lib/python3.9/typing.py", line 153, in _type_check
    raise TypeError(f"Plain {arg} is not valid as type argument")
TypeError: Plain typing_extensions.Self is not valid as type argument

解决:
查看当前typing-extensions版本为4.0.0

$ pip3 show typing-extensions
Name: typing_extensions
Version: 4.0.0
Summary: Backported and Experimental Type Hints for Python 3.6+
Home-page:
Author:
Author-email: "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa, Michael Lee" <levkivskyi@gmail.com>
License:
Location: /usr/local/lib/python3.9/dist-packages
Requires:
Required-by: astroid, async-lru, async-timeout, bpython, pylint, torch

升级typing-extensions

sudo -H pip3 install typing-extensions==4.5.0

问题解决。

要解决Plain typing.NoReturn is not valid as type argument错误,可以按照以下步骤进行: 1. 首先,根据引用中的描述,该错误通常是由Python版本过低引起的。因此,需要将Python升级到较高的版本。如果你使用的是anaconda环境,可以使用conda命令进行升级。具体的命令是:conda install python==3.7.2。 2. 当执行升级命令时,可能会出现“Proceed ([y]/n)?”的提示。你需要输入y,并按回车键确认。 3. 当看到“Executing transaction: done”时,表示升级成功。此时再次执行产生错误的操作,就不会再出现Plain typing.NoReturn is not valid as type argument的错误了。 请注意,以上解决方案是基于Python版本过低导致的错误。如果你在安装其他Python库时遇到相同的错误,也可以尝试使用相同的解决方案。希望这能帮助到你解决问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [【Python】处理TypeError: Plain typing.NoReturn is not valid as type argument](https://blog.csdn.net/weixin_43896318/article/details/126446332)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [TypeError: Plain typing.NoReturn is not valid as type argument解决方案](https://blog.csdn.net/weixin_43178406/article/details/132054244)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [2009 达内Unix学习笔记](https://download.csdn.net/download/lq_1987/2058996)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值