Hi i am having trouble importing backtrader and IbPy2. When i pip install both and when i run import backtrader in my python shell i get the following error:
i pip installed these:
pip install https://github.com/blampe/IbPy/archive/master.zip
pip install backtrader
The error i encountered:
Traceback (most recent call last):
File ~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3369 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Input In [3] in <cell line: 1>
import backtrader as bt
File ~/opt/anaconda3/lib/python3.9/site-packages/backtrader/__init__.py:62 in <module>
from .cerebro import *
File ~/opt/anaconda3/lib/python3.9/site-packages/backtrader/cerebro.py:35 in <module>
from .brokers import BackBroker
File ~/opt/anaconda3/lib/python3.9/site-packages/backtrader/brokers/__init__.py:30 in <module>
from .ibbroker import IBBroker
File ~/opt/anaconda3/lib/python3.9/site-packages/backtrader/brokers/ibbroker.py:30 in <module>
import ib.ext.Order
File ~/opt/anaconda3/lib/python3.9/site-packages/ib/ext/Order.py:9 in <module>
from ib.lib import Double, Integer
File ~/opt/anaconda3/lib/python3.9/site-packages/ib/lib/__init__.py:239
except (socket.error, ), ex:
^
SyntaxError: invalid syntax
The specs of my machine are:
- macbook air m1
- jupyterlabs
- anaconda
I think i pretty much narrowed the problem down to IbPy2's fault. Whenever i import backtrader with no IbPy2 installed it works fine. But soon as IbPy2 is installed using the above pip command i encounter this error.
Any help is appreciated and would make my week I have been stuck for days! Thank you in advance!