Unable to install SmartApi module


  • I'm encountering an issue while trying to install the SmartApi module, and despite attempting to install the PyCrypto module as well, the problem persists. Could you please assist me in resolving this issue?

    18a11575-222b-4604-896d-5b77f56ba3d2-image.png


  • Hi,

    Please refer the below link for error message resolution, but need confirmation from someone at AngelOne...

    https://stackoverflow.com/questions/68618362/cannot-install-build-pycrypto-python/75099672#75099672


  • Hi @rk_kondabathini

    Apologies for delayed response.
    Please find the steps for installation below:

    Software Requirements:
    Python
    Visual Studio Code or any editor
    Venv (virtual environment) for python

    Python Installation :
    Download and Install python from the link below based upon your operating system.
    https://www.python.org/downloads/
    Make sure you are installing python with the pip (python package index) so that you can install the necessary plugins and middleware in the sdk.

    Venv Environment Setup in Editor :

    Here we are going to use the Virtual environment for python to execute the api in the python sdk.
    To create the Venv environment in editor you can follow the below steps :
    Create a new folder and open the created folder in vs code.
    Then open the powershell and click on the git base. Then run the below command to create venv environment.

                             pip install virtualenv
    

    The above command will create the venv for python. Then you want to activate the venv by running the below command.

                           source venv/Scripts/activate    
    

    This command will activate the venv environment. Now we installed the virtual environment and activated it for the sdk execution.

    SDK Installation :

    You can install the smartapi python sdk from the following link smartapi-python and to run the pip install smartapi-python command as there in the webpage.
    The above command will install the smartapi python and you can see inside the venv folder.Then want to install the following middleware pyotp, logzero and websocket-client as required to run the python sdk. You can install through by running the pip install command with the middleware name.
    Then you can create a sample file like sample.py or test.py in the same folder.Then you can import the smartConnect by below and you can use the methods to access the api in the sdk.

    from SmartApi.smartConnect import SmartConnect
    obj=SmartConnect(api_key="your api key here")
    #login api call
    data = obj.generateSession("clientId","mpin","totp")

    The above method will get logged into sdk to access the api’s in the sdk and then you can access the other methods to access the order, GTT, profiles, Candle Data and logout.

    Thanks & Regards,
    SmartAPI team


  • This post is deleted!

  • Hi @rk_kondabathini

    Apologies for delayed response.
    For installing the smartapi for python we would like to recommend PIP(Package installer python) and Virtual environment(Venv) to run the sdk.

    Thanks & Regards,
    SmartAPI team