0

Getting the following stack trace from line:

zipline/zipline/__init__.py", line 17, in <module>
    import numpy as np
ImportError: No module named 'numpy'

however, when I check pip list

pip list | grep numpy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
numpy             1.16.6

This all occurs after I clone into the Quantopian/Zipline Github Repo. I opened an issue on github, after this edit I'll search SO for anything obvious I missed.

Environment

WSL Ubunut Subsystem

Pyhon 3.5.5

Bitness: 64

installed dependencies via sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev

Pip list

alembic           1.4.2
asn1crypto        0.24.0
bcolz             0.12.1
Bottleneck        1.3.2
certifi           2019.11.28
chardet           3.0.4
click             7.1.1
contextlib2       0.6.0.post1
cycler            0.10.0
cyordereddict     1.0.0
Cython            0.29.15
decorator         4.4.2
empyrical         0.5.3
enum34            1.1.6
funcsigs          1.0.2
idna              2.6
intervaltree      3.0.2
ipaddress         1.0.17
itable            0.0.1
keyring           10.6.0
Logbook           1.5.3
lru-dict          1.1.6
lxml              4.5.0
Mako              1.1.2
MarkupSafe        1.1.1
matplotlib        2.2.4
mercurial         4.5.3
mock              3.0.5
multipledispatch  0.6.0
networkx          1.11
numexpr           2.7.1
numpy             1.16.6
pandas            0.22.0
pandas-datareader 0.8.1
patsy             0.5.1
pinkfish          0.5.1
pip               19.3.1
pycrypto          2.6.1
pygobject         3.26.1
python-dateutil   2.8.1
python-editor     1.0.4
pytz              2019.3
pyxdg             0.25
requests          2.22.0
requests-file     1.4.3
scipy             1.2.2
SecretStorage     2.3.1
setuptools        39.0.1
six               1.14.0
sortedcontainers  2.1.0
SQLAlchemy        1.3.15
statsmodels       0.11.0
tables            3.5.2
toolz             0.10.0
trading-calendars 1.11.5
urllib3           1.25.7
wheel             0.30.0
zipline           1.3.0
WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Update

running as a script, sudo python test.py returns

File "test.py", line 1, in <module>
    import zipline
  File "../zipline/zipline/__init__.py", line 29, in <module>
    from .utils.run_algo import run_algorithm
  File "../zipline/zipline/utils/run_algo.py", line 17, in <module>
    from zipline.data import bundles
  File "../zipline/zipline/data/bundles/__init__.py", line 2, in <module>
    from . import quandl  # noqa
  File "../zipline/zipline/data/bundles/quandl.py", line 17, in <module>
    from . import core as bundles
  File "../zipline/zipline/data/bundles/core.py", line 14, in <module>
    from ..adjustments import SQLiteAdjustmentReader, SQLiteAdjustmentWriter
  File "../zipline/zipline/data/adjustments.py", line 24, in <module>
    from ._adjustments import load_adjustments_from_sqlite
ImportError: No module named _adjustments
Community
  • 1
  • 1
dang
  • 118
  • 1
  • 10
  • Have you tried `pip install trading-calendars`? – FlyingTeller Aug 01 '18 at 11:45
  • @FlyingTeller Yes, the module cannot be found/is unavailable through pip – dang Aug 01 '18 at 12:59
  • It's [on PyPi](https://pypi.org/project/trading-calendars/), don't know why your pip claims to not be able to find it. You can download and install it from [github](https://github.com/quantopian/trading_calendars) though – FlyingTeller Aug 01 '18 at 13:08
  • @FlyingTeller I figured it, thank you for the assist though – dang Aug 01 '18 at 13:09
  • Nevermind, just saw that the PyPi version goes only to Python 3.5. But you can still install manually – FlyingTeller Aug 01 '18 at 13:10
  • @FlyingTeller yes it looks like manual is going to be the fix. I'll edit the question because now I'm having setup.py issues :)))) – dang Aug 01 '18 at 13:14
  • Hi Dan, have you tried using conda? The easiest and best supported way is through conda http://www.zipline.io/install.html#windows as Zipline has several C dependencies. – freddiev4 Aug 06 '18 at 01:08
  • @freddiev4 I switched to WSL Ubuntu flavor – dang Mar 24 '20 at 18:02

1 Answers1

0

The issue arose due to the presence of multiple versions of python. Using the python -m pip install <packages> command inside of the zipline/zipline repo, I was able to successful execute import zipline inside a python shell

dang
  • 118
  • 1
  • 10