Search code examples
python-3.6interactive-brokers

Adding the ibapi library to PYTHONPATH module in Spyder (Python 3.6)


I am trying to simply connect to the ibapi (Interactive Brokers API), but I am having some technical troubles with Spyder.

What I did so far:

  1. I installed the latest version for Windows from here
  2. I provided the following path to the PYTHONPATH manager in Spyder: C:\TWS API\source\pythonclient\ibapi afterwards I restarted Spyder

When I simply type import ibapi I get the same error message: ModuleNotFoundError: No module named 'ibapi'

What I am doing wrong here and how can I fix this simple error?


Solution

  • I don't use python very much but I'm pretty sure you have to install the ibapi. I never used the PYTHONPATH and mine works fine in Spyder and Jupyter. I'm using Anaconda.

    I run the Anaconda prompt (just activates the conda environment) and navigate to the dir C:\TWS API\source\pythonclient and run python setup.py install

    Then everything works. I think many python packages need to be installed like this.

    note: That's not my install dir, I just copied yours. There may be a problem with a space in the path. Try renaming to C:\TWSAPI\... if you still have a problem.