Python crashes when I try the sample code.



  • Hi,
    I just started with backtrader. Naturally, I coded the sample program given in the git main page ( https://github.com/mementum/backtrader ). I installed the latest version of the backtrader with pip, and I do have matplotlib (1.5.1). But when I run the code, python crashes at cerebro.plot() line in the sample code.

    I appreciate any help. Thanks.
    More info:
    I use Python 3.5.1 :: Anaconda 4.0.0 (64-bit)
    pip list output:

    alabaster (0.7.7)
    anaconda-client (1.4.0)
    anaconda-navigator (1.1.1)
    argcomplete (1.0.0)
    astropy (1.1.2)
    Babel (2.2.0)
    backtrader (1.9.47.116)
    beautifulsoup4 (4.4.1)
    bitarray (0.8.1)
    blaze (0.9.1)
    bokeh (0.11.1)
    boto (2.39.0)
    Bottleneck (1.0.0)
    cffi (1.5.2)
    chest (0.2.3)
    cloudpickle (0.1.1)
    clyent (1.2.1)
    colorama (0.3.7)
    comtypes (1.1.2)
    conda (4.0.7)
    conda-build (1.20.0)
    conda-env (2.4.5)
    conda-manager (0.4.0)
    configobj (5.0.6)
    cryptography (1.3)
    cycler (0.10.0)
    Cython (0.23.4)
    cytoolz (0.7.5)
    dask (0.8.1)
    datashape (0.5.1)
    decorator (4.0.9)
    dill (0.2.4)
    docutils (0.12)
    dynd (c328ab7)
    et-xmlfile (1.0.1)
    fastcache (1.0.2)
    Flask (0.10.1)
    Flask-Cors (2.1.2)
    gevent (1.1.0)
    greenlet (0.4.9)
    h5py (2.5.0)
    HeapDict (1.0.0)
    html5lib (0.999)
    ibapi (9.73.2, c:\tws api\source\pythonclient)
    idna (2.0)
    ipykernel (4.3.1)
    ipython (4.1.2)
    ipython-genutils (0.1.0)
    ipywidgets (4.1.1)
    itsdangerous (0.24)
    jdcal (1.2)
    jedi (0.9.0)
    Jinja2 (2.8)
    jsonschema (2.4.0)
    jupyter (1.0.0)
    jupyter-client (4.2.2)
    jupyter-console (4.1.1)
    jupyter-core (4.1.0)
    llvmlite (0.9.0)
    locket (0.2.0)
    lxml (3.6.0)
    MarkupSafe (0.23)
    matplotlib (1.5.1)
    menuinst (1.3.2)
    mistune (0.7.2)
    mpmath (0.19)
    multipledispatch (0.4.8)
    nbconvert (4.1.0)
    nbformat (4.0.1)
    networkx (1.11)
    nltk (3.2)
    nose (1.3.7)
    notebook (4.1.0)
    numba (0.24.0)
    numexpr (2.5)
    numpy (1.12.1)
    odo (0.4.2)
    openpyxl (2.3.2)
    pandas (0.19.2)
    pandas-datareader (0.3.0.post0)
    partd (0.3.2)
    path.py (0.0.0)
    patsy (0.4.0)
    pep8 (1.7.0)
    pickleshare (0.5)
    Pillow (3.1.1)
    pip (9.0.1)
    ply (3.8)
    psutil (4.1.0)
    py (1.4.31)
    pyasn1 (0.1.9)
    pycosat (0.6.1)
    pycparser (2.14)
    pycrypto (2.6.1)
    pyflakes (1.1.0)
    Pygments (2.1.1)
    pyOpenSSL (0.15.1)
    pyparsing (2.0.3)
    pyreadline (2.1)
    pytest (2.8.5)
    python-dateutil (2.6.0)
    pytz (2017.2)
    pywin32 (220)
    PyYAML (3.11)
    pyzmq (15.2.0)
    QtAwesome (0.3.2)
    qtconsole (4.2.0)
    QtPy (1.0)
    requests (2.14.1)
    requests-file (1.4.2)
    requests-ftp (0.3.1)
    rope-py3k (0.9.4.post1)
    scikit-image (0.12.3)
    scikit-learn (0.17.1)
    scipy (0.17.0)
    setuptools (20.3)
    simplegeneric (0.8.1)
    singledispatch (3.4.0.3)
    six (1.10.0)
    snowballstemmer (1.2.1)
    sockjs-tornado (1.0.1)
    Sphinx (1.3.1)
    sphinx-rtd-theme (0.1.9)
    spyder (2.3.8)
    SQLAlchemy (1.0.12)
    statsmodels (0.6.1)
    sympy (1.0)
    tables (3.2.2)
    toolz (0.7.4)
    tornado (4.3)
    traitlets (4.2.1)
    unicodecsv (0.14.1)
    Werkzeug (0.11.4)
    wheel (0.29.0)
    xlrd (0.9.4)
    XlsxWriter (0.8.4)
    xlwings (0.7.0)
    xlwt (1.0.0)



  • Solved.

    I just needed to upgrade matplotlib.

    sorry for the bother..


  • administrators

    Seems odd anyhow, because the above list shows matplotlib with version 1.5.1. It may have been that such version broke some behavior (not only in backtrader) and was later corrected.



  • Thank you very much for the reply.
    I downgraded maplotlib to 1.4.1 as it is the suggested min version in the git main page. It did not help either. Only after I upgraded matplotlib to latest, it worked.
    I was thinking the suggested matplotlib version in the main page of git should be updated.
    Thanks.


  • administrators

    The code is usually run against an old 1.5.0rc3. The situation that arises with a downgrade is that many other packages should also be downgraded to achieve the actual status that version had at that time. This was seen with pyfolio, which has changed the API. Version 0.5.1 had a compatible API, but that version had also expectations about the surrounding ecosystem ... hence the problem of downgrading.


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.