For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

backtrader connection errors

  • am getting the error''ModuleNotFoundError: No module named 'backtrader'
    anytime i run any code in the ide

    from future import (absolute_import, division, print_function,

    import backtrader as bt

    if name == 'main':
    cerebro = bt.Cerebro()

    print('Starting Portfolio Value: %.2f' %
    print('Final Portfolio Value: %.2f' %

    ModuleNotFoundError Traceback (most recent call last)
    <ipython-input-1-bd9375d3f4ab> in <module>
    2 unicode_literals)
    ----> 4 import backtrader as bt
    6 if name == 'main':

    ModuleNotFoundError: No module named 'backtrader'

  • First guess would be that the script you try to run has name. Rename it. If it doesn't fix the error, than you have some issue swith the installation. Feel free to google how to fix ModuleNotFoundError: error. Correctly installed and used bt doesn't return this error.

Log in to reply