cannot import zipline package after successful conda installation

444 Views Asked by At

python version -3.5.6
using anaconda, c++build tools are installed
pip install zipline works perfectly
import zipline # gives error below

(myenv) c:\users>>>pip show zipline
Name: zipline
Version: 1.4.1
Summary: A backtester for financial algorithms.
Home-page: https://zipline.io
Author: Quantopian Inc.
Author-email: [email protected]
License: Apache 2.0
Location: c:\users\user\anaconda3\envs\ziplinerr\lib\site-packages
Requires: pip, setuptools, Logbook, click, six, python-interface, multipledispat
ch, toolz, numpy, pandas, pandas-datareader, scipy, patsy, statsmodels, empyrica
l, pytz, iso3166, trading-calendars, requests, sqlalchemy, alembic, bcolz, h5py,
tables, lru-dict, intervaltree, bottleneck, networkx, numexpr, iso4217

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\zipline\__init_
_.py", line 29, in <module>
    from .utils.run_algo import run_algorithm
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\zipline\utils\r
un_algo.py", line 20, in <module>
    from zipline.data import bundles
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\zipline\data\bu
ndles\__init__.py", line 2, in <module>
    from . import quandl  # noqa
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\zipline\data\bu
ndles\quandl.py", line 16, in <module>
    from . import core as bundles
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\zipline\data\bu
ndles\core.py", line 15, in <module>
    from ..minute_bars import (
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\zipline\data\mi
nute_bars.py", line 24, in <module>
    import h5py
  File "C:\Users\User\anaconda3\envs\ziplinerr\lib\site-packages\h5py\__init__.p
y", line 36, in <module>
    from ._conv import register_converters as _register_converters
  File "h5py\h5r.pxd", line 21, in init h5py._conv
  File "h5py\_objects.pxd", line 12, in init h5py.h5r
  File "h5py\_objects.pyx", line 1, in init h5py._objects
ImportError: DLL load failed: The specified procedure could not be found.
1

There are 1 best solutions below

0
BLimitless On

this worked for me:

# Create environment
conda create -n zipline_env python=3.6 ipykernel

# Activate environment, make sure you can see it in jupyter notebooks
conda activate zipline_env
python -m ipykernel install --user --name=zipline_env

# Install Zipline
conda install -c conda-forge zipline

If I swapped the order of the steps, it didn't work. After the above order is complete, then conda installing packages I want works fine, like jupyter, matplotlib, etc.