Error: "cannot import name 'ParamSpec' " while trying to import KiteConnect

saurabhhuf
I installed kiteconnect using:
pip install --upgrade kiteconnect
pip install -U pip setuptools

Now, I am trying to import kiteconnect module : from kiteconnect import KiteConnect

But I am getting following error:

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\default.py in _getInstallFunction(platform)
48 else:
---> 49 from twisted.internet.selectreactor import install
50 except ImportError:

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\selectreactor.py in
17
---> 18 from twisted.internet import posixbase
19 from twisted.internet.interfaces import IReactorFDSet

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\posixbase.py in
15
---> 16 from twisted.internet import error, tcp, udp
17 from twisted.internet.base import ReactorBase, _SignalReactorMixin

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\tcp.py in
98 # Twisted Imports
---> 99 from twisted.internet import abstract, address, base, error, fdesc, main
100 from twisted.internet.error import CannotListenError

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py in
33
---> 34 from twisted.internet import abstract, defer, error, fdesc, main, threads
35 from twisted.internet._resolver import (

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\defer.py in
41 from incremental import Version
---> 42 from typing_extensions import Literal, ParamSpec, Protocol
43

ImportError: cannot import name 'ParamSpec' from 'typing_extensions' (C:\ProgramData\Anaconda3\lib\site-packages\typing_extensions.py)

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
----> 1 from kiteconnect import KiteConnect
2
3 api_key = "i7begzqwlrre8m41"
4 api_secret = "4e8sql223yeyn54pzpe2qfhycka9lhxm"
5

C:\ProgramData\Anaconda3\lib\site-packages\kiteconnect\__init__.py in
111 from kiteconnect import exceptions
112 from kiteconnect.connect import KiteConnect
--> 113 from kiteconnect.ticker import KiteTicker
114
115 __all__ = ["KiteConnect", "KiteTicker", "exceptions"]

C:\ProgramData\Anaconda3\lib\site-packages\kiteconnect\ticker.py in
16 import threading
17 from datetime import datetime
---> 18 from twisted.internet import reactor, ssl
19 from twisted.python import log as twisted_log
20 from twisted.internet.protocol import ReconnectingClientFactory

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\reactor.py in
36
37 del sys.modules["twisted.internet.reactor"]
---> 38 from twisted.internet import default
39
40 default.install()

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\default.py in
53
54
---> 55 install = _getInstallFunction(platform)

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\default.py in _getInstallFunction(platform)
49 from twisted.internet.selectreactor import install
50 except ImportError:
---> 51 from twisted.internet.selectreactor import install
52 return install
53

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\selectreactor.py in
16 from zope.interface import implementer
17
---> 18 from twisted.internet import posixbase
19 from twisted.internet.interfaces import IReactorFDSet
20 from twisted.python import log

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\posixbase.py in
14 from zope.interface import classImplements, implementer
15
---> 16 from twisted.internet import error, tcp, udp
17 from twisted.internet.base import ReactorBase, _SignalReactorMixin
18 from twisted.internet.interfaces import (

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\tcp.py in
97
98 # Twisted Imports
---> 99 from twisted.internet import abstract, address, base, error, fdesc, main
100 from twisted.internet.error import CannotListenError
101 from twisted.internet.protocol import Protocol

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\base.py in
32 from zope.interface import classImplements, implementer
33
---> 34 from twisted.internet import abstract, defer, error, fdesc, main, threads
35 from twisted.internet._resolver import (
36 ComplexResolverSimplifier as _ComplexResolverSimplifier,

C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\defer.py in
40 import attr
41 from incremental import Version
---> 42 from typing_extensions import Literal, ParamSpec, Protocol
43
44 from twisted.internet.interfaces import IDelayedCall, IReactorTime

ImportError: cannot import name 'ParamSpec' from 'typing_extensions' (C:\ProgramData\Anaconda3\lib\site-packages\typing_extensions.py)
  • saurabhhuf
    I updated the typing_extensions package and then pyopenssl, to fix this and next error. Now, I am getting another error:

    ---------------------------------------------------------------------------
    ModuleNotFoundError Traceback (most recent call last)
    in
    ----> 1 from kiteconnect import KiteConnect
    2
    3 api_key = "i7begzqwlrre8m41"
    4 api_secret = "4e8sql223yeyn54pzpe2qfhycka9lhxm"
    5

    C:\ProgramData\Anaconda3\lib\site-packages\kiteconnect\__init__.py in
    111 from kiteconnect import exceptions
    112 from kiteconnect.connect import KiteConnect
    --> 113 from kiteconnect.ticker import KiteTicker
    114
    115 __all__ = ["KiteConnect", "KiteTicker", "exceptions"]

    C:\ProgramData\Anaconda3\lib\site-packages\kiteconnect\ticker.py in
    19 from twisted.python import log as twisted_log
    20 from twisted.internet.protocol import ReconnectingClientFactory
    ---> 21 from autobahn.twisted.websocket import WebSocketClientProtocol, \
    22 WebSocketClientFactory, connectWS
    23

    C:\ProgramData\Anaconda3\lib\site-packages\autobahn\twisted\__init__.py in
    42
    43 # WebSocket protocol support
    ---> 44 from autobahn.twisted.websocket import \
    45 WebSocketServerProtocol, \
    46 WebSocketClientProtocol, \

    C:\ProgramData\Anaconda3\lib\site-packages\autobahn\twisted\websocket.py in
    36
    37 import twisted.internet.protocol
    ---> 38 from twisted.internet import endpoints
    39 from twisted.internet.interfaces import ITransport, ISSLTransport
    40

    C:\ProgramData\Anaconda3\lib\site-packages\twisted\internet\endpoints.py in
    61 from twisted.python.failure import Failure
    62 from twisted.python.filepath import FilePath
    ---> 63 from twisted.python.systemd import ListenFDs
    64 from ._idna import _idnaBytes, _idnaText
    65

    C:\ProgramData\Anaconda3\lib\site-packages\twisted\python\systemd.py in
    16 from typing import Dict, List, Mapping, Optional, Sequence
    17
    ---> 18 from attrs import Factory, define
    19
    20

    ModuleNotFoundError: No module named 'attrs'
  • rakeshr
    ModuleNotFoundError: No module named 'attrs'
    Use the steps mentioned in this thread.
  • saurabhhuf
    Yes, was able to do that. Thanks
This discussion has been closed.