No module named tda error occurs when tda-api module is not properly installed or its path is not set. It is an API wrapper for TD Ameritrade platform. It provides an API interface to web connectivity, Data Transfer, and Authentication in easier python binding syntax with TD Ameritrade platform. Typically while developing any python based application if invoke this TDA-API module without installing it, We have to face this error. In this article, We will explore the best way to fix this error.
Modulenotfounderror: no module named tda : (Solution ) –
We need to install this tda-api module. We can install tda-api using pip package manager with single command as the best way. Or we can use source code and build the tda-api package locally using setup.py. The setup.py method is generic but complex and time-consuming. So I will recommend you to go with pip package manager. Let’s address them one by one.
Solution 1: Installing tda-api using pip –
The binary/wheel distribution is already uploaded in PYPI Hub. We can download install and set the path using one single command. You may follow the same.
pip install tad-api
It will install the latest version for tda-api. If you want any specific version, Use the below similar pip command.
pip install tad-api==version
This version-specific command will help you in downgrading and upgrading tda-api module in case of any incompatibility.
Solution 2: Installing tda-api from source code –
This is a typical way of installing any python package where all the .py code ( source code )is available. Use the below command.
python setup.py install
End Notes :
There are some other alternatives or similar packages as tda-api which works as a client API for TD Ameritrade. One of the popular ones is tdameritrade. Here is the command for this.
conda install -c conda-forge tdameritrade
I hope this error is no more trouble for you.
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.