python-3.xzipline

Cannot import Zipline package after successful installation


I am using python3.6 with anaconda3. And I have successfully installed zipline with command pip install zipline

~$ pip install zipline
Collecting zipline
Requirement already satisfied: multipledispatch>=0.4.8 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: Mako>=1.0.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pandas<0.19,>=0.18.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: tables>=3.3.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pip>=7.1.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: MarkupSafe>=0.23 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: bottleneck>=1.0.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: scipy>=0.17.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: decorator>=4.0.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: setuptools>18.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: toolz>=0.8.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: python-dateutil>=2.4.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: numexpr>=2.6.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: patsy>=0.4.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: numpy>=1.11.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: click>=4.0.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: alembic>=0.7.7 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: Cython>=0.25.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: sortedcontainers>=1.4.4 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: requests>=2.9.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: sqlalchemy>=1.0.8 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: bcolz<1,>=0.12.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: six>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pandas-datareader<0.6,>=0.2.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: lru-dict>=1.1.4 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: networkx<2.0,>=1.9.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: intervaltree>=2.1.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: empyrical>=0.4.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: contextlib2>=0.4.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: statsmodels>=0.6.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: Logbook>=0.12.5 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pytz>=2016.4 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: cyordereddict>=0.2.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: requests-file>=1.4.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: python-editor>=0.3 in ./anaconda3/lib/python3.6/site-packages (from alembic>=0.7.7->zipline)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: idna<2.7,>=2.5 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: requests-ftp in ./anaconda3/lib/python3.6/site-packages (from pandas-datareader<0.6,>=0.2.1->zipline)
Installing collected packages: zipline
Successfully installed zipline-1.2.0

However, after installation, when I ran the following code an error raised.

import zipline as zp
print(zp.__version__)

.

Traceback (most recent call last):
  File "/Users/chunyinwong/Documents/PycharmProjects/IB/ziplinetut.py", line 1, in <module>
    import zipline as zp
  File "/anaconda3/lib/python3.6/site-packages/zipline/__init__.py", line 20, in <module>
    from . import data
  File "/anaconda3/lib/python3.6/site-packages/zipline/data/__init__.py", line 1, in <module>
    from . import loader
  File "/anaconda3/lib/python3.6/site-packages/zipline/data/loader.py", line 17, in <module>
    import logbook
  File "/anaconda3/lib/python3.6/site-packages/logbook/__init__.py", line 14, in <module>
    from .base import (
  File "/anaconda3/lib/python3.6/site-packages/logbook/base.py", line 19, in <module>
    from logbook.concurrency import (greenlet_get_ident, thread_get_ident,
ImportError: cannot import name 'thread_get_ident'

Process finished with exit code 1

I've tried to run the same code on Jupyter notebook and Pycharm, but have the same result.

Any help is appreciated:)


Solution

  • Update the logbook to the latest version

    Since the logbook is outdated, so cannot import greenlet_get_ident, thread_get_ident