I’m new to python and need some guidance.
I used this tutorial to install zipline and create the virtual environment
Installation — Zipline 3.0 docs (ml4trading.io)
Then after jupyter was installed, I also used the following tutorial to import my notebooks into the environment
在conda创建的虚拟环境中安装jupyter以及使用_conda install juypyter-CSDN博客
Eventually,I got an error running zipline on jupyter by import zipline, and the error was as follows:
--------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[8], line 2
1 import pandas as pd
----> 2 import zipline as zipline
File ~\anaconda3\envs\ML4T\lib\site-packages\zipline\__init__.py:21
17 import numpy as np
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
23 from . import data
24 from . import finance
File ~\anaconda3\envs\ML4T\lib\site-packages\trading_calendars\__init__.py:16
1 #
2 # Copyright 2018 Quantopian, Inc.
3 #
(...)
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
---> 16 from .trading_calendar import TradingCalendar
17 from .calendar_utils import (
18 clear_calendars,
19 deregister_calendar,
(...)
25 resolve_alias,
26 )
28 __all__ = [
29 'clear_calendars',
30 'deregister_calendar',
(...)
37 'TradingCalendar',
38 ]
File ~\anaconda3\envs\ML4T\lib\site-packages\trading_calendars\trading_calendar.py:33
30 from pandas.tseries.offsets import CustomBusinessDay
31 import toolz
---> 33 from .calendar_helpers import (
34 NP_NAT,
35 compute_all_minutes,
36 next_divider_idx,
37 previous_divider_idx,
38 )
39 from .utils.memoize import lazyval
40 from .utils.pandas_utils import days_at_time
File ~\anaconda3\envs\ML4T\lib\site-packages\trading_calendars\calendar_helpers.py:6
2 import pandas as pd
4 NANOSECONDS_PER_MINUTE = int(6e10)
----> 6 NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
9 def next_divider_idx(dividers, minute_val):
11 divider_idx = np.searchsorted(dividers, minute_val, side="right")
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NaTType'
Selection deleted
I tried to ask gpt and he told me that it could be an incompatible version of numpy, pand, etc., but that installing with conda should have installed all dependencies at once.
Here is the information about my current environment package version
# Name Version Build Channel
alembic 1.13.1 pyhd8ed1ab_0 conda-forge
anyio 4.2.0 pyhd8ed1ab_0 conda-forge
argon2-cffi 23.1.0 pyhd8ed1ab_0 conda-forge
argon2-cffi-bindings 21.2.0 py310h8d17308_4 conda-forge
arrow 1.3.0 pyhd8ed1ab_0 conda-forge
asttokens 2.4.1 pyhd8ed1ab_0 conda-forge
async-lru 2.0.4 pyhd8ed1ab_0 conda-forge
attrs 23.2.0 pyh71513ae_0 conda-forge
babel 2.14.0 pyhd8ed1ab_0 conda-forge
bcolz-zipline 1.2.5 py310hf4a77e7_0 ml4t
beautifulsoup4 4.12.2 pyha770c72_0 conda-forge
bleach 6.1.0 pyhd8ed1ab_0 conda-forge
blosc 1.21.5 hdccc3a2_0 conda-forge
bottleneck 1.3.7 py310h3e78b6c_1 conda-forge
brotli-python 1.1.0 py310h00ffb61_1 conda-forge
bzip2 1.0.8 hcfcfb64_5 conda-forge
c-blosc2 2.12.0 h183a6f4_0 conda-forge
ca-certificates 2023.11.17 h56e8100_0 conda-forge
cached-property 1.5.2 hd8ed1ab_1 conda-forge
cached_property 1.5.2 pyha770c72_1 conda-forge
certifi 2023.11.17 pyhd8ed1ab_0 conda-forge
cffi 1.16.0 py310h8d17308_0 conda-forge
charset-normalizer 3.3.2 pyhd8ed1ab_0 conda-forge
click 8.1.7 win_pyh7428d3b_0 conda-forge
colorama 0.4.6 pyhd8ed1ab_0 conda-forge
comm 0.1.4 pyhd8ed1ab_0 conda-forge
debugpy 1.8.0 py310h00ffb61_1 conda-forge
decorator 5.1.1 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
empyrical-reloaded 0.5.9 pyhd8ed1ab_0 conda-forge
entrypoints 0.4 pyhd8ed1ab_0 conda-forge
exceptiongroup 1.2.0 pyhd8ed1ab_0 conda-forge
executing 2.0.1 pyhd8ed1ab_0 conda-forge
fqdn 1.5.1 pyhd8ed1ab_0 conda-forge
greenlet 3.0.3 py310h00ffb61_0 conda-forge
h5py 3.10.0 nompi_py310hde4a0ea_101 conda-forge
hdf5 1.14.3 nompi_h73e8ff5_100 conda-forge
idna 3.6 pyhd8ed1ab_0 conda-forge
importlib-metadata 7.0.1 pyha770c72_0 conda-forge
importlib_metadata 7.0.1 hd8ed1ab_0 conda-forge
importlib_resources 6.1.1 pyhd8ed1ab_0 conda-forge
intel-openmp 2024.0.0 h57928b3_49840 conda-forge
intervaltree 3.1.0 pyhd8ed1ab_1 conda-forge
ipykernel 6.28.0 pyha63f2e9_0 conda-forge
ipython 8.19.0 pyh7428d3b_0 conda-forge
ipywidgets 8.1.1 pyhd8ed1ab_0 conda-forge
iso3166 2.1.1 pyhd8ed1ab_0 conda-forge
iso4217 1.9.20220401 pyhd8ed1ab_0 conda-forge
isoduration 20.11.0 pyhd8ed1ab_0 conda-forge
jedi 0.19.1 pyhd8ed1ab_0 conda-forge
jinja2 3.1.2 pyhd8ed1ab_1 conda-forge
json5 0.9.14 pyhd8ed1ab_0 conda-forge
jsonpointer 2.4 py310h5588dad_3 conda-forge
jsonschema 4.20.0 pyhd8ed1ab_0 conda-forge
jsonschema-specifications 2023.12.1 pyhd8ed1ab_0 conda-forge
jsonschema-with-format-nongpl 4.20.0 pyhd8ed1ab_0 conda-forge
jupyter 1.0.0 pyhd8ed1ab_10 conda-forge
jupyter-lsp 2.2.1 pyhd8ed1ab_0 conda-forge
jupyter_client 8.6.0 pyhd8ed1ab_0 conda-forge
jupyter_console 6.6.3 pyhd8ed1ab_0 conda-forge
jupyter_core 5.6.1 py310h5588dad_0 conda-forge
jupyter_events 0.9.0 pyhd8ed1ab_0 conda-forge
jupyter_server 2.12.1 pyhd8ed1ab_0 conda-forge
jupyter_server_terminals 0.5.1 pyhd8ed1ab_0 conda-forge
jupyterlab 4.0.10 pyhd8ed1ab_0 conda-forge
jupyterlab_pygments 0.3.0 pyhd8ed1ab_0 conda-forge
jupyterlab_server 2.25.2 pyhd8ed1ab_0 conda-forge
jupyterlab_widgets 3.0.9 pyhd8ed1ab_0 conda-forge
krb5 1.21.2 heb0366b_0 conda-forge
libaec 1.1.2 h63175ca_1 conda-forge
libblas 3.9.0 18_win64_mkl conda-forge
libcblas 3.9.0 18_win64_mkl conda-forge
libcurl 8.5.0 hd5e4a3a_0 conda-forge
libffi 3.4.2 h8ffe710_5 conda-forge
libiconv 1.17 hcfcfb64_2 conda-forge
liblapack 3.9.0 18_win64_mkl conda-forge
libsodium 1.0.18 h8d14728_1 conda-forge
libsqlite 3.44.2 hcfcfb64_0 conda-forge
libssh2 1.11.0 h7dfc565_0 conda-forge
libta-lib 0.4.0 hcfcfb64_2 conda-forge
libxml2 2.10.4 hc3477c8_0 conda-forge
libxslt 1.1.37 h2bbff1b_1
libzlib 1.2.13 hcfcfb64_5 conda-forge
logbook 1.7.0.post0 py310h8d17308_0 conda-forge
lru-dict 1.3.0 py310h8d17308_0 conda-forge
lxml 4.9.3 py310h09808a7_0
lz4-c 1.9.4 hcfcfb64_0 conda-forge
mako 1.3.0 pyhd8ed1ab_0 conda-forge
markupsafe 2.1.3 py310h8d17308_1 conda-forge
matplotlib-inline 0.1.6 pyhd8ed1ab_0 conda-forge
mistune 3.0.2 pyhd8ed1ab_0 conda-forge
mkl 2022.1.0 h6a75c08_874 conda-forge
multipledispatch 0.6.0 py_0 conda-forge
multitasking 0.0.9 pyhd8ed1ab_0 conda-forge
nbclient 0.8.0 pyhd8ed1ab_0 conda-forge
nbconvert 7.14.0 pyhd8ed1ab_0 conda-forge
nbconvert-core 7.14.0 pyhd8ed1ab_0 conda-forge
nbconvert-pandoc 7.14.0 pyhd8ed1ab_0 conda-forge
nbformat 5.9.2 pyhd8ed1ab_0 conda-forge
nest-asyncio 1.5.8 pyhd8ed1ab_0 conda-forge
networkx 3.2.1 pyhd8ed1ab_0 conda-forge
notebook 7.0.6 pyhd8ed1ab_0 conda-forge
notebook-shim 0.2.3 pyhd8ed1ab_0 conda-forge
numexpr 2.8.4 mkl_py310h98e78b8_1 conda-forge
numpy 1.26.2 py310hf667824_0 conda-forge
openssl 3.2.0 hcfcfb64_1 conda-forge
overrides 7.4.0 pyhd8ed1ab_0 conda-forge
packaging 23.2 pyhd8ed1ab_0 conda-forge
pandas 2.1.4 py310hecd3228_0 conda-forge
pandas-datareader 0.10.0 pyh6c4a22f_0 conda-forge
pandoc 3.1.3 h57928b3_0 conda-forge
pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge
parso 0.8.3 pyhd8ed1ab_0 conda-forge
patsy 0.5.5 pyhd8ed1ab_0 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pip 23.3.2 pyhd8ed1ab_0 conda-forge
pkgutil-resolve-name 1.3.10 pyhd8ed1ab_1 conda-forge
platformdirs 4.1.0 pyhd8ed1ab_0 conda-forge
prometheus_client 0.19.0 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.42 pyha770c72_0 conda-forge
prompt_toolkit 3.0.42 hd8ed1ab_0 conda-forge
psutil 5.9.7 py310h8d17308_0 conda-forge
pure_eval 0.2.2 pyhd8ed1ab_0 conda-forge
py-cpuinfo 9.0.0 pyhd8ed1ab_0 conda-forge
pycparser 2.21 pyhd8ed1ab_0 conda-forge
pygments 2.17.2 pyhd8ed1ab_0 conda-forge
pysocks 1.7.1 pyh0701188_6 conda-forge
pytables 3.9.2 py310hde27e41_1 conda-forge
python 3.10.13 h4de0772_1_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-fastjsonschema 2.19.1 pyhd8ed1ab_0 conda-forge
python-interface 1.6.0 py_0 conda-forge
python-json-logger 2.0.7 pyhd8ed1ab_0 conda-forge
python-tzdata 2023.4 pyhd8ed1ab_0 conda-forge
python_abi 3.10 4_cp310 conda-forge
pytz 2023.3.post1 pyhd8ed1ab_0 conda-forge
pywin32 306 py310h00ffb61_2 conda-forge
pywinpty 2.0.12 py310h00ffb61_0 conda-forge
pyyaml 6.0.1 py310h8d17308_1 conda-forge
pyzmq 25.1.2 py310h2849c00_0 conda-forge
qtconsole-base 5.5.1 pyha770c72_0 conda-forge
qtpy 2.4.1 pyhd8ed1ab_0 conda-forge
referencing 0.32.0 pyhd8ed1ab_0 conda-forge
requests 2.31.0 pyhd8ed1ab_0 conda-forge
rfc3339-validator 0.1.4 pyhd8ed1ab_0 conda-forge
rfc3986-validator 0.1.1 pyh9f0ad1d_0 conda-forge
rpds-py 0.16.2 py310h87d50f1_0 conda-forge
scipy 1.11.4 py310hf667824_0 conda-forge
send2trash 1.8.2 pyh08f2357_0 conda-forge
setuptools 68.2.2 pyhd8ed1ab_0 conda-forge
six 1.16.0 pyh6c4a22f_0 conda-forge
snappy 1.1.10 hfb803bf_0 conda-forge
sniffio 1.3.0 pyhd8ed1ab_0 conda-forge
sortedcontainers 2.4.0 pyhd8ed1ab_0 conda-forge
soupsieve 2.5 pyhd8ed1ab_1 conda-forge
sqlalchemy 2.0.24 py310h8d17308_0 conda-forge
stack_data 0.6.2 pyhd8ed1ab_0 conda-forge
statsmodels 0.14.1 py310h3e78b6c_0 conda-forge
ta-lib 0.4.19 py310h9b08ddd_4 conda-forge
tbb 2021.8.0 h59b6b97_0
terminado 0.18.0 pyh5737063_0 conda-forge
tinycss2 1.2.1 pyhd8ed1ab_0 conda-forge
tk 8.6.13 h5226925_1 conda-forge
tomli 2.0.1 pyhd8ed1ab_0 conda-forge
toolz 0.12.0 pyhd8ed1ab_0 conda-forge
tornado 6.3.3 py310h8d17308_1 conda-forge
trading-calendars 2.1.1 pyhd3deb0d_0 conda-forge
traitlets 5.14.0 pyhd8ed1ab_0 conda-forge
types-python-dateutil 2.8.19.14 pyhd8ed1ab_0 conda-forge
typing-extensions 4.9.0 hd8ed1ab_0 conda-forge
typing_extensions 4.9.0 pyha770c72_0 conda-forge
typing_utils 0.1.0 pyhd8ed1ab_0 conda-forge
tzdata 2023d h0c530f3_0 conda-forge
ucrt 10.0.22621.0 h57928b3_0 conda-forge
uri-template 1.3.0 pyhd8ed1ab_0 conda-forge
urllib3 2.1.0 pyhd8ed1ab_0 conda-forge
vc 14.3 hcf57466_18 conda-forge
vc14_runtime 14.38.33130 h82b7239_18 conda-forge
vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge
wcwidth 0.2.12 pyhd8ed1ab_0 conda-forge
webcolors 1.13 pyhd8ed1ab_0 conda-forge
webencodings 0.5.1 pyhd8ed1ab_2 conda-forge
websocket-client 1.7.0 pyhd8ed1ab_0 conda-forge
wheel 0.42.0 pyhd8ed1ab_0 conda-forge
widgetsnbextension 4.0.9 pyhd8ed1ab_0 conda-forge
win_inet_pton 1.1.0 pyhd8ed1ab_6 conda-forge
winpty 0.4.3 4 conda-forge
xz 5.2.6 h8d14728_0 conda-forge
yaml 0.2.5 h8ffe710_2 conda-forge
yfinance 0.1.63 py_0 ml4t
zeromq 4.3.5 h63175ca_0 conda-forge
zipline-reloaded 2.0.0.post1 he6999da_0 ml4t
zipp 3.17.0 pyhd8ed1ab_0 conda-forge
zlib-ng 2.0.7 hcfcfb64_0 conda-forge
zstd 1.5.5 h12be248_0 conda-forge