quantopian / zipline

Zipline, a Pythonic Algorithmic Trading Library
https://www.zipline.io
Apache License 2.0
17.53k stars 4.71k forks source link

zipline ingest fails with empyrical==0.3.0 #1857

Closed achalvs closed 7 years ago

achalvs commented 7 years ago

Dear Zipline Maintainers,

Before I tell you about my issue, let me describe my environment:

Environment

Now that you know a little about me, let me tell you about the issue I am having:

Description of Issue

When attempting to run the example code on the README.rst, I run into the following issue:

path/to/awesome/dir$ zipline ingest
Traceback (most recent call last):
  File "/Users/achalvs/.virtualenvs/test/bin/zipline", line 7, in <module>
    from zipline.__main__ import main
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/__init__.py", line 42, in <module>
    from .utils.run_algo import run_algorithm
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/utils/run_algo.py", line 17, in <module>
    from zipline.algorithm import TradingAlgorithm
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/algorithm.py", line 85, in <module>
    from zipline.finance.performance import PerformanceTracker
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/finance/performance/__init__.py", line 16, in <module>
    from . tracker import PerformanceTracker
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/finance/performance/tracker.py", line 69, in <module>
    import zipline.finance.risk as risk
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/finance/risk/__init__.py", line 16, in <module>
    from . report import RiskReport
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/finance/risk/report.py", line 64, in <module>
    from . period import RiskMetricsPeriod
  File "/Users/achalvs/.virtualenvs/test/lib/python2.7/site-packages/zipline/finance/risk/period.py", line 28, in <module>
    from empyrical import (
ImportError: cannot import name information_ratio

Note that this occurs when using version 0.3.0 of empyrical, but after switching to version 0.2.2, this error is gone. It seems that the method information_ratio failed to make it into 0.3.0.

I expected the zipline ingest to download some data.

I received the traceback above.

Here is how you can reproduce this issue on your machine:

Reproduction Steps

  1. Install zipline==1.1.0 and empyrical==0.3.0 (and all deps) to a new virtualenvironment
  2. Call zipline ingest from the command line.

What steps have you taken to resolve this already?

I uninstalled empyrical version 0.3.0 and installed empyrical 0.2.2.

Sincerely, achal

achalvs commented 7 years ago

requirements.txt

richafrank commented 7 years ago

Thanks @achalvs ! The latest empyrical release broke compatibility with zipline, so you can either downgrade empyrical to 0.2.2 or install the compatibility branch of zipline that hasn't been merged to master yet.

x-ref https://github.com/quantopian/zipline/issues/1855

richafrank commented 7 years ago

zipline master should work with the latest empyrical now.

csullivan commented 7 years ago

I was pleased to see this commit last night, it fixed the ImportError: cannot import name information_ratio. Immediately, however, a new issue appeared on import of zipline (and zipline ingest):


Python 3.4.2 (default, Oct  8 2014, 10:45:20) 
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/zipline/__init__.py", line 20, in <module>
    from . import data
  File "/zipline/data/__init__.py", line 1, in <module>
    from . import loader
  File "/zipline/data/loader.py", line 32, in <module>
    from zipline.utils.calendars import get_calendar
  File "/zipline/utils/calendars/__init__.py", line 16, in <module>
    from .trading_calendar import TradingCalendar
  File "/zipline/utils/calendars/trading_calendar.py", line 30, in <module>
    from zipline.utils.calendars._calendar_helpers import (
ImportError: No module named 'zipline.utils.calendars._calendar_helpers'

Not sure if this is related to the empyrical issue or not. If it is separate, I will open a new issue.

csullivan commented 7 years ago

It's possible the above is related to this issue as well: https://github.com/quantopian/zipline/issues/1417

freddiev4 commented 7 years ago

Hi there. This should be fixed in the latest release :). Going to close this. Feel free to reopen if you see this issue again