Cannot import KiteConnect

NishithSavla
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/filename.py", line 7, in <module>
from kiteconnect import KiteConnect
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/kiteconnect/_init_.py", line 113, in <module>
from kiteconnect.ticker import KiteTicker
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/kiteconnect/ticker.py", line 18, in <module>
from twisted.internet import reactor, ssl
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/twisted/internet/ssl.py", line 60, in <module>
from OpenSSL import SSL
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/OpenSSL/_init_.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/OpenSSL/crypto.py", line 11, in <module>
from OpenSSL._util import (
File "/root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/OpenSSL/_util.py", 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/binding.py", line 14, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: /root/anaconda3/envs/iTrend_py39/lib/python3.9/site-packages/_cffi_backend.cpython-39-x86_64-linux-gnu.so: symbol ffi_type_uint32 version LIBFFI_BASE_7.0 not defined in file libffi.so.7 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.