Jack J
Jack J

Reputation: 1

Can't import Self from typing-extensions

I am trying to run pyvisa in jupyter notebook, but when I try to import pyvisa I get an error that I can't import Self from typing-extensions.

I have tried to import Self independently and typing-extensions is definitely installed. I am on python version 3.9.7.

The error is:

ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_7240/3478553642.py in <module>
      4 get_ipython().system('pip install typing-extensions')
      5 
----> 6 import pyvisa as pv

~\anaconda3\lib\site-packages\pyvisa\__init__.py in <module>
     26     VisaTypeError,
     27 )
---> 28 from .highlevel import ResourceManager
     29 from .resources import Resource  # noqa : F401 This is needed to register all resources.
     30 

~\anaconda3\lib\site-packages\pyvisa\highlevel.py in <module>
     41 from typing_extensions import ClassVar, DefaultDict, Literal
     42 
---> 43 from . import attributes, constants, errors, logger, rname
     44 from .constants import StatusCode
     45 from .typing import (

~\anaconda3\lib\site-packages\pyvisa\rname.py in <module>
     24 )
     25 
---> 26 from typing_extensions import ClassVar, Self
     27 
     28 from . import constants, errors, logger

ImportError: cannot import name 'Self' from 'typing_extensions' (C:\Users\jackj\anaconda3\lib\site-packages\typing_extensions.py)

Edit: I am using version 4.12.2 of typing-extesions

Upvotes: 0

Views: 222

Answers (0)

Related Questions