5

Hi I am trying to install ibapi in python however the package seems to be unavailable because there is an error every time I try to install it is there another way I can install this package . Your help will be greatly appreciated. I have left the code I used. to try and install the package

pip install ibapi
  • 1
    For more recent visitors - **DO NOT** use PyPI - a version has now existed on PyPI since 2020 but it has not been updated since then. It describes itself as the official version but it is some years out of date. – Hagrid67 Mar 26 '23 at 15:16

4 Answers4

19

The official Interactive Brokers API is only offered through their Github site and not the Python Package Index (PyPI) because its distributed under a different license. You can however build a wheel from the provided source code and then install the wheel. These are the steps:

1) Download "API Latest" from http://interactivebrokers.github.io/

2) Unzip or install (if its a .msi file) the download.

3) Go to tws-api/source/pythonclient/

4) Build a wheel with: python3 setup.py bdist_wheel

5) Install the wheel with:

python3 -m pip install --user --upgrade dist/ibapi-9.73.7-py3-none-any.whl

Josh
  • 706
  • 3
  • 8
  • 1
    If you're using a new venv and you get `error: invalid command 'bdist_wheel` at step 4 then do `python3 -m pip install wheel` because you don't have wheel installed. Thank you Josh! – Jesse Pangburn Sep 28 '19 at 22:02
  • This is the correct answer and the instructions basically match the official documentation, but nicely condensed. – fantabolous Oct 02 '19 at 07:49
  • The package on the IB site asks me to agree to a non commercial license and on the Pypi page it says commercial or non commercial license, and I see the Pypi one basically correspond to the stable version on the IB website. So I think the 2 options are in fact the same ? – Lewen May 22 '20 at 20:45
  • There is a version on PyPI but it is old; it seems to have been uploaded in 2020 by an enthusiast who never updated it. – Hagrid67 Mar 26 '23 at 15:12
9

Here a step by step setup instructions for Windows:

  1. Download and install TWS Gateway or Client
  2. Download and install Python to C:\Program Files\python... (and not the suggested ...\user\App... - gives you some more flexibility)
  3. Setup additional PATH environment variables (see pip warnings)
  4. Install wheel, i.e. type in the command line: py -m pip install wheel
  5. Download "API Latest" (or latest version that contains python) from http://interactivebrokers.github.io/ and install into the folder X as proposed (but for python the directory shouldn't matter)
  6. Go to X/.../source/pythonclient/ (cd in command line)
  7. Build a wheel, i.e. py setup.py bdist_wheel
  8. Look up the whl file in folder ./dist: should be something like ibapi-9.7x.x..
  9. Install the wheel, i.e. py -m pip install --user --upgrade dist/ibapi-9.73.7-py3-none-any.whl
VengaVenga
  • 680
  • 1
  • 10
  • 13
-3

A pip search of the term ibapi only returns two packages.

ibapi-grease (0.2.0)  - Monkey patches to grease the Interactive Brokers Python API
tws-async (0.5.7)     - Use the Interactive Brokers API (IBAPI) asynchonously with asyncio or PyQt5

If you pip search for ib however, more Interactive Brokers related packages appear, which might be might you are looking for. Packages like:

ib-tools (0.1)
ib-wrapper (0.1.0)
ib (0.8.0)
ib-api (0.9.70)
ib-client (0.1.2)
ib-dl (1.5.3)
ib-insync (0.9.56)
ib-python (0.0.1)
ib-trading-calendars (0.1.2)
ibdb (0.0.0a4)
Alex
  • 509
  • 4
  • 8
-4

there is no pypi package called "ibapi"

if this is the one you are after : https://pypi.org/project/ibapi-grease/

then do

pip install ibapi-grease

or

https://pypi.org/project/ib-api/

pip install ib-api
Derek Eden
  • 4,403
  • 3
  • 18
  • 31
  • No, don't do these. `pip show ibapi` and you will see `Summary: Official Interactive Brokers API` and `Author: IBG LLC` and even if it isn't there anymore, you can download the source from their site. https://stackoverflow.com/a/57618526/227755 – nurettin Aug 09 '22 at 08:23
  • ya, that's why I said "if" – Derek Eden Aug 09 '22 at 18:00