Cannot import KiteConnect

NishithSavla edited February 2023 in Python client
I have a script where I'm using KiteConnect version 4.2.0 and when I try to import it using,
from kiteconnect import KiteConnect
I get the following error
Traceback (most recent call last):
File "/iTrend/python/Live/OPSTRA/", line 7, in <module>
from kiteconnect import KiteConnect
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/kiteconnect/", line 113, in <module>
from kiteconnect.ticker import KiteTicker
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/kiteconnect/", line 18, in <module>
from twisted.internet import reactor, ssl
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/twisted/internet/", line 60, in <module>
from OpenSSL import SSL
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/OpenSSL/", line 8, in <module>
from OpenSSL import crypto, SSL
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/OpenSSL/", line 11, in <module>
from OpenSSL._util import (
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/OpenSSL/", line 5, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/ symbol ffi_type_uint32 version LIBFFI_BASE_7.0 not defined in file with link time reference
I have tried all the following solution:
  • Updating all system packages using sudo apt update && sudo apt upgrade
  • Upgrading pyopenssl using pip install pyopenssl --upgrade
  • Installing libffi with sudo apt-get install libffi-dev
Can anyone please help me with this?
  • rakeshr
    sudo apt-get install libffi-dev
    I think, you need to install both libffi and libffi-dev.
    Maybe you can try :
    sudo apt-get install libffi6 libffi-dev
Sign In or Register to comment.