Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 511
Newskooler Avatar asked Dec 19 '22 01:12

Newskooler


2 Answers

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.

like image 100
brian Avatar answered Dec 20 '22 13:12

brian


Note: after python setup.py install, you might need to restart spyder. If doesn't help, then copy the newly-created ibapi folder to:

C:\Users\iuzeri\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

or

C:\Program Files (x86)\Python37-32\Lib\site-packages

like image 42
T.Todua Avatar answered Dec 20 '22 15:12

T.Todua