Skip to content

Error importing zipline (trading calendars) #29

@Tvix22

Description

@Tvix22

Dear Zipline Maintainers,

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

Environment

  • Operating System: (Windows Version or $ uname --all) Ubuntu
  • Python Version: $ python --version : Python 3.9.1
  • Python Bitness: $ python -c 'import math, sys;print(int(math.log(sys.maxsize + 1, 2) + 1))'
  • How did you install Zipline: (pip, conda, or other (please explain)) pip install zipline-reloeaded
  • Python packages: $ pip freeze or $ conda list
  • packages in environment at /home/jcx/miniconda3:

Name Version Build Channel

_libgcc_mutex 0.1 main
alembic 1.6.5 pypi_0 pypi
anyio 3.2.1 py39hf3d152e_0 conda-forge
argon2-cffi 20.1.0 py39hbd71b63_2 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 21.2.0 pyhd8ed1ab_0 conda-forge
babel 2.9.1 pyh44b312d_0 conda-forge
backcall 0.2.0 pyh9f0ad1d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.4 pyhd8ed1ab_0 conda-forge
bcolz-zipline 1.2.3.post2 pypi_0 pypi
bleach 3.3.0 pyh44b312d_0 conda-forge
bottleneck 1.3.2 pypi_0 pypi
brotlipy 0.7.0 py39h27cfd23_1003
ca-certificates 2021.5.30 ha878542_0 conda-forge
certifi 2021.5.30 py39hf3d152e_0 conda-forge
cffi 1.14.4 py39h261ae71_0
chardet 3.0.4 py39h06a4308_1003
click 8.0.1 pypi_0 pypi
conda 4.10.3 py39hf3d152e_0 conda-forge
conda-package-handling 1.7.2 py39h27cfd23_1
cryptography 3.3.1 py39h3c74f83_0
decorator 4.4.2 pypi_0 pypi
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
empyrical-reloaded 0.5.7 pypi_0 pypi
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
greenlet 1.1.0 pypi_0 pypi
h5py 3.3.0 pypi_0 pypi
idna 2.10 py_0
importlib-metadata 4.6.0 py39hf3d152e_0 conda-forge
intervaltree 3.1.0 pypi_0 pypi
ipykernel 5.5.5 py39hef51801_0 conda-forge
ipython 7.25.0 py39hef51801_1 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
iso3166 1.0.1 pypi_0 pypi
iso4217 1.6.20180829 pypi_0 pypi
jedi 0.18.0 py39hf3d152e_2 conda-forge
jinja2 2.11.3 pyh44b312d_0 conda-forge
json5 0.9.5 pyh9f0ad1d_0 conda-forge
jsonschema 3.2.0 pyhd8ed1ab_3 conda-forge
jupyter_client 6.1.12 pyhd8ed1ab_0 conda-forge
jupyter_core 4.7.1 py39hf3d152e_0 conda-forge
jupyter_server 1.9.0 pyhd8ed1ab_0 conda-forge
jupyterlab 3.0.16 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
jupyterlab_server 2.6.0 pyhd8ed1ab_0 conda-forge
ld_impl_linux-64 2.33.1 h53a641e_7
libedit 3.1.20191231 h14c3975_1
libffi 3.3 he6710b0_2
libgcc-ng 9.1.0 hdf63c60_0
libsodium 1.0.18 h36c2ea0_1 conda-forge
libstdcxx-ng 9.1.0 hdf63c60_0
logbook 1.5.3 pypi_0 pypi
lru-dict 1.1.7 pypi_0 pypi
lxml 4.6.3 pypi_0 pypi
mako 1.1.4 pypi_0 pypi
markupsafe 1.1.1 py39h38d8fee_2 conda-forge
matplotlib-inline 0.1.2 pyhd8ed1ab_2 conda-forge
mistune 0.8.4 py39hbd71b63_1002 conda-forge
multipledispatch 0.6.0 pypi_0 pypi
multitasking 0.0.9 pypi_0 pypi
nbclassic 0.3.1 pyhd8ed1ab_1 conda-forge
nbclient 0.5.3 pyhd8ed1ab_0 conda-forge
nbconvert 6.1.0 py39hf3d152e_0 conda-forge
nbformat 5.1.3 pyhd8ed1ab_0 conda-forge
ncurses 6.2 he6710b0_1
nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge
networkx 2.5.1 pypi_0 pypi
notebook 6.4.0 pyha770c72_0 conda-forge
numexpr 2.7.3 pypi_0 pypi
numpy 1.21.0 pypi_0 pypi
openssl 1.1.1k h27cfd23_0
packaging 21.0 pyhd8ed1ab_0 conda-forge
pandas 1.3.0 pypi_0 pypi
pandas-datareader 0.9.0 pypi_0 pypi
pandoc 2.14.0.3 h7f98852_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
parso 0.8.2 pyhd8ed1ab_0 conda-forge
patsy 0.5.1 pypi_0 pypi
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pip 20.3.1 py39h06a4308_0
prometheus_client 0.11.0 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.19 pyha770c72_0 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pycosat 0.6.3 py39h27cfd23_0
pycparser 2.20 py_2
pygments 2.9.0 pyhd8ed1ab_0 conda-forge
pyopenssl 20.0.0 pyhd3eb1b0_1
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.17.3 py39hbd71b63_1 conda-forge
pysocks 1.7.1 py39h06a4308_0
python 3.9.1 hdb3f193_2
python-dateutil 2.8.1 py_0 conda-forge
python-editor 1.0.4 pypi_0 pypi
python-interface 1.6.1 pypi_0 pypi
python_abi 3.9 2_cp39 conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyzmq 19.0.2 py39hb69f2a1_2 conda-forge
readline 8.0 h7b6447c_0
requests 2.25.0 pyhd3eb1b0_0
requests-unixsocket 0.2.0 py_0 conda-forge
ruamel_yaml 0.15.80 py39h27cfd23_0
scipy 1.7.0 pypi_0 pypi
send2trash 1.7.1 pyhd8ed1ab_0 conda-forge
setuptools 51.0.0 py39h06a4308_2
six 1.15.0 py39h06a4308_0
sniffio 1.2.0 py39hf3d152e_1 conda-forge
sortedcontainers 2.4.0 pypi_0 pypi
sqlalchemy 1.4.20 pypi_0 pypi
sqlite 3.33.0 h62c20be_0
statsmodels 0.12.2 pypi_0 pypi
ta-lib 0.4.20 pypi_0 pypi
terminado 0.10.1 py39hf3d152e_0 conda-forge
testpath 0.5.0 pyhd8ed1ab_0 conda-forge
tk 8.6.10 hbc83047_0
toolz 0.11.1 pypi_0 pypi
tornado 6.1 py39hbd71b63_0 conda-forge
tqdm 4.54.1 pyhd3eb1b0_0
trading-calendars 2.1.1 pypi_0 pypi
traitlets 5.0.5 py_0 conda-forge
tzdata 2020d h14c3975_0
urllib3 1.25.11 py_0
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
websocket-client 0.57.0 py39hf3d152e_4 conda-forge
wheel 0.36.1 pyhd3eb1b0_0
xz 5.2.5 h7b6447c_0
yaml 0.2.5 h7b6447c_0
yfinance 0.1.60 pypi_0 pypi
zeromq 4.3.4 h2531618_0
zipline-reloaded 2.0.0.post1 pypi_0 pypi
zipp 3.5.0 pyhd8ed1ab_0 conda-forge
zlib 1.2.11 h7b6447c_3

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

Description of Issue

When i use import zipline a recive an error i cant fix

  • What did you expect to happen?
    just import zipline
  • What happened instead?

TypeError Traceback (most recent call last)
in
----> 1 import zipline

~/miniconda3/lib/python3.9/site-packages/zipline/init.py in
19 # This is not a place to dump arbitrary classes/modules for convenience,
20 # it is a place to expose the public interfaces.
---> 21 from trading_calendars import get_calendar
22
23 from . import data

~/miniconda3/lib/python3.9/site-packages/trading_calendars/init.py in
14 # limitations under the License.
15
---> 16 from .trading_calendar import TradingCalendar
17 from .calendar_utils import (
18 clear_calendars,

~/miniconda3/lib/python3.9/site-packages/trading_calendars/trading_calendar.py in
31 import toolz
32
---> 33 from .calendar_helpers import (
34 NP_NAT,
35 compute_all_minutes,

~/miniconda3/lib/python3.9/site-packages/trading_calendars/calendar_helpers.py in
4 NANOSECONDS_PER_MINUTE = int(6e10)
5
----> 6 NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
7
8

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType'

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

Reproduction Steps

  1. create conda env
  2. pip install zipline-reloaded
  3. from jupyterlab import zipline
    ...

What steps have you taken to resolve this already?

...

Anything else?

...

Sincerely,

JCX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions