Jupyter Notebook 无法连接到内核,可能是由于 Zipline / AssertionError
Jupyter Notebook Cannot Connect to Kernel, Likely due to Zipline / AssertionError
我的所有虚拟环境都工作正常,除了 jupyter notebook 无法连接内核的环境。此环境中有 Zipline,因此我预计存在一些依赖性问题,即使我使用 Conda 安装了所有软件包。
我已经阅读了问题和答案 here,不幸的是,将 tornado 降级到 5.1.1 没有成功,我也没有收到 ValueErrors。但是,我收到一个与 Class NSProcessInfo.
相关的 AssertionError
我在 M1 Mac 上。从终端登录显示下面的错误,我的环境文件在下面。有人可以帮我让这个内核工作吗?谢谢!
[I 08:11:54.738 NotebookApp] Kernel started: 01327890-c603-461c-b82d-90bc7fd196ae, name: conda-env-env_zipline-py
[W 08:11:54.832 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js (::1) 5.650000ms referer=http://localhost:8888/notebooks/10-Quantopian-Platform/BSM%20Quantopian-Zipline%20Notes.ipynb
Traceback (most recent call last):
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance
app.initialize(argv)
File "<decorator-gen-121>", line 2, in initialize
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 582, in initialize
self.init_kernel()
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 452, in init_kernel
user_ns=self.user_ns,
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 86, in __init__
appnope.nope()
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/appnope/_nope.py", line 90, in nope
"Because Reasons"
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/appnope/_nope.py", line 60, in beginActivityWithOptions
NSProcessInfo = C('NSProcessInfo')
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/appnope/_nope.py", line 38, in C
assert ret is not None, "Couldn't find Class %s" % classname
AssertionError: Couldn't find Class NSProcessInfo
# packages in environment at /opt/homebrew/anaconda3/envs/env_zipline:
#
# Name Version Build Channel
alembic 1.5.8 pyhd8ed1ab_0 conda-forge
appnope 0.1.2 py36h79c6626_1 conda-forge
argon2-cffi 20.1.0 py36h20b66c6_2 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 20.3.0 pyhd3deb0d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.3 pyhd8ed1ab_0 conda-forge
bcolz 1.2.1 py36h4f17bb1_1001 conda-forge
bleach 3.3.0 pyh44b312d_0 conda-forge
blosc 1.19.0 h4a8c4bd_0 conda-forge
bokeh 2.3.0 py36h79c6626_0 conda-forge
bottleneck 1.3.2 py36h809c706_3 conda-forge
brotlipy 0.7.0 py36h20b66c6_1001 conda-forge
bzip2 1.0.8 hc929b4f_4 conda-forge
ca-certificates 2021.1.19 hecd8cb5_1
cached-property 1.5.2 hd8ed1ab_1 conda-forge
cached_property 1.5.2 pyha770c72_1 conda-forge
certifi 2020.12.5 py36hecd8cb5_0
cffi 1.14.5 py36hfaecaff_0 conda-forge
chardet 4.0.0 py36h79c6626_1 conda-forge
click 7.1.2 pyh9f0ad1d_0 conda-forge
cloudpickle 1.6.0 py_0 conda-forge
contextvars 2.4 py_0 conda-forge
cryptography 3.4.7 py36h3d45be8_0 conda-forge
cytoolz 0.11.0 py36h20b66c6_3 conda-forge
dask 2.10.1 py_0 conda-forge
dask-core 2.10.1 py_0 conda-forge
decorator 4.4.2 py_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
distributed 2.30.1 py36h79c6626_0 conda-forge
empyrical 0.5.5 pyh9f0ad1d_0 conda-forge
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
freetype 2.10.4 h4cff582_1 conda-forge
fsspec 0.8.7 pyhd8ed1ab_0 conda-forge
greenlet 0.4.16 py36h37b9a7d_0 conda-forge
h5py 3.1.0 nompi_py36h9252a2b_100 conda-forge
hdf5 1.10.6 nompi_h3e39495_100 conda-forge
heapdict 1.0.1 py_0 conda-forge
idna 2.10 pyh9f0ad1d_0 conda-forge
immutables 0.15 py36h49ba835_0 conda-forge
importlib-metadata 3.9.1 py36h79c6626_0 conda-forge
intervaltree 3.0.2 py_0 conda-forge
ipykernel 5.3.4 py36h5ca1d4c_0
ipython 5.8.0 py36_1 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
iso3166 1.0.1 pyh9f0ad1d_0 conda-forge
iso4217 1.6.20180829 py_0 conda-forge
jinja2 2.11.3 pyh44b312d_0 conda-forge
jpeg 9d hbcb3906_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 py36h79c6626_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
lcms2 2.11 h11f7e16_1 conda-forge
libblas 3.9.0 8_openblas conda-forge
libcblas 3.9.0 8_openblas conda-forge
libcxx 10.0.0 1
libffi 3.3 hb1e8313_2
libgfortran 4.0.0 7_5_0_h1a10cd1_21 conda-forge
libgfortran4 7.5.0 h1a10cd1_21 conda-forge
liblapack 3.9.0 8_openblas conda-forge
libopenblas 0.3.12 openmp_h63d9170_1 conda-forge
libpng 1.6.37 h7cec526_2 conda-forge
libsodium 1.0.18 hbcb3906_1 conda-forge
libtiff 4.1.0 ha78913b_3 conda-forge
llvm-openmp 11.1.0 hda6cdc1_0 conda-forge
locket 0.2.0 py_2 conda-forge
logbook 1.5.3 py36h20b66c6_4 conda-forge
lru-dict 1.1.6 py36h20b66c6_3 conda-forge
lz4-c 1.9.2 h4a8c4bd_1 conda-forge
mako 1.1.4 pyh44b312d_0 conda-forge
markupsafe 1.1.1 py36h20b66c6_3 conda-forge
mistune 0.8.4 py36h20b66c6_1003 conda-forge
mock 4.0.3 py36h79c6626_1 conda-forge
msgpack-python 1.0.0 py36h863e41a_1 conda-forge
multipledispatch 0.6.0 py_0 conda-forge
nb_conda 2.2.1 py36_0
nb_conda_kernels 2.3.1 py36hecd8cb5_0
nbclient 0.5.3 pyhd8ed1ab_0 conda-forge
nbconvert 6.0.7 py36h79c6626_3 conda-forge
nbformat 5.1.2 pyhd8ed1ab_1 conda-forge
ncurses 6.2 h0a44026_1
nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge
networkx 1.11 py36_0 conda-forge
notebook 6.3.0 py36hecd8cb5_0
numexpr 2.7.1 py36hcc1bba6_1 conda-forge
numpy 1.19.5 py36h08dc641_1 conda-forge
olefile 0.46 pyh9f0ad1d_1 conda-forge
openssl 1.1.1k h9ed2024_0
packaging 20.9 pyh44b312d_0 conda-forge
pandas 0.22.0 py36_1 conda-forge
pandas-datareader 0.6.0 py36_0 conda-forge
pandoc 2.13 h0d85af4_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
partd 1.1.0 py_0 conda-forge
patsy 0.5.1 py_0 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 8.1.0 py36hc04f27d_1 conda-forge
pip 21.0.1 py36hecd8cb5_0
prometheus_client 0.9.0 pyhd3deb0d_0 conda-forge
prompt_toolkit 1.0.15 py_1 conda-forge
psutil 5.8.0 py36h20b66c6_1 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pygments 2.8.1 pyhd8ed1ab_0 conda-forge
pyopenssl 20.0.1 pyhd8ed1ab_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.17.3 py36h20b66c6_2 conda-forge
pysocks 1.7.1 py36h79c6626_3 conda-forge
pytables 3.6.1 py36hce38db3_2 conda-forge
python 3.6.13 h88f2d9e_0
python-dateutil 2.8.1 py_0 conda-forge
python-editor 1.0.4 py_0 conda-forge
python-interface 1.6.0 py_0 conda-forge
python_abi 3.6 1_cp36m conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyyaml 5.4.1 py36h20b66c6_0 conda-forge
pyzmq 20.0.0 py36h23ab428_1
readline 8.1 h9ed2024_0
requests 2.25.1 pyhd3deb0d_0 conda-forge
requests-file 1.5.1 pyh9f0ad1d_0 conda-forge
requests-ftp 0.3.1 py_1 conda-forge
scipy 1.5.1 py36h1dac7e4_0 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 52.0.0 py36hecd8cb5_0
simplegeneric 0.8.1 py_1 conda-forge
six 1.15.0 pyh9f0ad1d_0 conda-forge
sortedcontainers 2.3.0 pyhd8ed1ab_0 conda-forge
sqlalchemy 1.4.3 py36hfa26744_0 conda-forge
sqlite 3.35.2 hce871da_0
statsmodels 0.11.1 py36h37b9a7d_2 conda-forge
tblib 1.7.0 pyhd8ed1ab_0 conda-forge
terminado 0.9.4 py36h79c6626_0 conda-forge
testpath 0.4.4 py_0 conda-forge
tk 8.6.10 hb0a8c7a_0
toolz 0.11.1 py_0 conda-forge
tornado 5.1.1 py36h1de35cc_0
trading-calendars 2.1.1 pyhd3deb0d_0 conda-forge
traitlets 4.3.3 py36h9f0ad1d_1 conda-forge
typing_extensions 3.7.4.3 py_0 conda-forge
urllib3 1.26.4 pyhd8ed1ab_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.36.2 pyhd3eb1b0_0
xz 5.2.5 h1de35cc_0
yaml 0.2.5 haf1e3a3_0 conda-forge
zeromq 4.3.4 h23ab428_0
zict 2.0.0 py_0 conda-forge
zipline 1.4.1 py36haf1e3a3_0 conda-forge
zipp 3.4.1 pyhd8ed1ab_0 conda-forge
zlib 1.2.11 h1de35cc_3
zstd 1.4.5 h0384e3a_1 conda-forge
想通了。
什么有效:
# 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
完成后,您可以使用 conda 安装其他软件包,如 jupyter、matplotlib 等,这些依赖项对我来说都很好。
为什么:
- Zipline 在本地需要 python 3.6 到 运行,因此需要使用 python 3.6.
设置环境
- 为了在 Jupyter Notebook 中查看环境,我也一直在安装 nb_conda,这可能是问题所在。通过在创建环境时仅安装 ipykernel,然后使用上面的命令行 ipykernel 命令使其在 jupyter notebook 中可见,我就可以避免 nb_conda.
我的所有虚拟环境都工作正常,除了 jupyter notebook 无法连接内核的环境。此环境中有 Zipline,因此我预计存在一些依赖性问题,即使我使用 Conda 安装了所有软件包。
我已经阅读了问题和答案 here,不幸的是,将 tornado 降级到 5.1.1 没有成功,我也没有收到 ValueErrors。但是,我收到一个与 Class NSProcessInfo.
相关的 AssertionError我在 M1 Mac 上。从终端登录显示下面的错误,我的环境文件在下面。有人可以帮我让这个内核工作吗?谢谢!
[I 08:11:54.738 NotebookApp] Kernel started: 01327890-c603-461c-b82d-90bc7fd196ae, name: conda-env-env_zipline-py
[W 08:11:54.832 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js (::1) 5.650000ms referer=http://localhost:8888/notebooks/10-Quantopian-Platform/BSM%20Quantopian-Zipline%20Notes.ipynb
Traceback (most recent call last):
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance
app.initialize(argv)
File "<decorator-gen-121>", line 2, in initialize
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 582, in initialize
self.init_kernel()
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel/kernelapp.py", line 452, in init_kernel
user_ns=self.user_ns,
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 86, in __init__
appnope.nope()
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/appnope/_nope.py", line 90, in nope
"Because Reasons"
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/appnope/_nope.py", line 60, in beginActivityWithOptions
NSProcessInfo = C('NSProcessInfo')
File "/opt/homebrew/anaconda3/envs/env_zipline/lib/python3.6/site-packages/appnope/_nope.py", line 38, in C
assert ret is not None, "Couldn't find Class %s" % classname
AssertionError: Couldn't find Class NSProcessInfo
# packages in environment at /opt/homebrew/anaconda3/envs/env_zipline:
#
# Name Version Build Channel
alembic 1.5.8 pyhd8ed1ab_0 conda-forge
appnope 0.1.2 py36h79c6626_1 conda-forge
argon2-cffi 20.1.0 py36h20b66c6_2 conda-forge
async_generator 1.10 py_0 conda-forge
attrs 20.3.0 pyhd3deb0d_0 conda-forge
backports 1.0 py_2 conda-forge
backports.functools_lru_cache 1.6.3 pyhd8ed1ab_0 conda-forge
bcolz 1.2.1 py36h4f17bb1_1001 conda-forge
bleach 3.3.0 pyh44b312d_0 conda-forge
blosc 1.19.0 h4a8c4bd_0 conda-forge
bokeh 2.3.0 py36h79c6626_0 conda-forge
bottleneck 1.3.2 py36h809c706_3 conda-forge
brotlipy 0.7.0 py36h20b66c6_1001 conda-forge
bzip2 1.0.8 hc929b4f_4 conda-forge
ca-certificates 2021.1.19 hecd8cb5_1
cached-property 1.5.2 hd8ed1ab_1 conda-forge
cached_property 1.5.2 pyha770c72_1 conda-forge
certifi 2020.12.5 py36hecd8cb5_0
cffi 1.14.5 py36hfaecaff_0 conda-forge
chardet 4.0.0 py36h79c6626_1 conda-forge
click 7.1.2 pyh9f0ad1d_0 conda-forge
cloudpickle 1.6.0 py_0 conda-forge
contextvars 2.4 py_0 conda-forge
cryptography 3.4.7 py36h3d45be8_0 conda-forge
cytoolz 0.11.0 py36h20b66c6_3 conda-forge
dask 2.10.1 py_0 conda-forge
dask-core 2.10.1 py_0 conda-forge
decorator 4.4.2 py_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
distributed 2.30.1 py36h79c6626_0 conda-forge
empyrical 0.5.5 pyh9f0ad1d_0 conda-forge
entrypoints 0.3 pyhd8ed1ab_1003 conda-forge
freetype 2.10.4 h4cff582_1 conda-forge
fsspec 0.8.7 pyhd8ed1ab_0 conda-forge
greenlet 0.4.16 py36h37b9a7d_0 conda-forge
h5py 3.1.0 nompi_py36h9252a2b_100 conda-forge
hdf5 1.10.6 nompi_h3e39495_100 conda-forge
heapdict 1.0.1 py_0 conda-forge
idna 2.10 pyh9f0ad1d_0 conda-forge
immutables 0.15 py36h49ba835_0 conda-forge
importlib-metadata 3.9.1 py36h79c6626_0 conda-forge
intervaltree 3.0.2 py_0 conda-forge
ipykernel 5.3.4 py36h5ca1d4c_0
ipython 5.8.0 py36_1 conda-forge
ipython_genutils 0.2.0 py_1 conda-forge
iso3166 1.0.1 pyh9f0ad1d_0 conda-forge
iso4217 1.6.20180829 py_0 conda-forge
jinja2 2.11.3 pyh44b312d_0 conda-forge
jpeg 9d hbcb3906_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 py36h79c6626_0 conda-forge
jupyterlab_pygments 0.1.2 pyh9f0ad1d_0 conda-forge
lcms2 2.11 h11f7e16_1 conda-forge
libblas 3.9.0 8_openblas conda-forge
libcblas 3.9.0 8_openblas conda-forge
libcxx 10.0.0 1
libffi 3.3 hb1e8313_2
libgfortran 4.0.0 7_5_0_h1a10cd1_21 conda-forge
libgfortran4 7.5.0 h1a10cd1_21 conda-forge
liblapack 3.9.0 8_openblas conda-forge
libopenblas 0.3.12 openmp_h63d9170_1 conda-forge
libpng 1.6.37 h7cec526_2 conda-forge
libsodium 1.0.18 hbcb3906_1 conda-forge
libtiff 4.1.0 ha78913b_3 conda-forge
llvm-openmp 11.1.0 hda6cdc1_0 conda-forge
locket 0.2.0 py_2 conda-forge
logbook 1.5.3 py36h20b66c6_4 conda-forge
lru-dict 1.1.6 py36h20b66c6_3 conda-forge
lz4-c 1.9.2 h4a8c4bd_1 conda-forge
mako 1.1.4 pyh44b312d_0 conda-forge
markupsafe 1.1.1 py36h20b66c6_3 conda-forge
mistune 0.8.4 py36h20b66c6_1003 conda-forge
mock 4.0.3 py36h79c6626_1 conda-forge
msgpack-python 1.0.0 py36h863e41a_1 conda-forge
multipledispatch 0.6.0 py_0 conda-forge
nb_conda 2.2.1 py36_0
nb_conda_kernels 2.3.1 py36hecd8cb5_0
nbclient 0.5.3 pyhd8ed1ab_0 conda-forge
nbconvert 6.0.7 py36h79c6626_3 conda-forge
nbformat 5.1.2 pyhd8ed1ab_1 conda-forge
ncurses 6.2 h0a44026_1
nest-asyncio 1.5.1 pyhd8ed1ab_0 conda-forge
networkx 1.11 py36_0 conda-forge
notebook 6.3.0 py36hecd8cb5_0
numexpr 2.7.1 py36hcc1bba6_1 conda-forge
numpy 1.19.5 py36h08dc641_1 conda-forge
olefile 0.46 pyh9f0ad1d_1 conda-forge
openssl 1.1.1k h9ed2024_0
packaging 20.9 pyh44b312d_0 conda-forge
pandas 0.22.0 py36_1 conda-forge
pandas-datareader 0.6.0 py36_0 conda-forge
pandoc 2.13 h0d85af4_0 conda-forge
pandocfilters 1.4.2 py_1 conda-forge
partd 1.1.0 py_0 conda-forge
patsy 0.5.1 py_0 conda-forge
pexpect 4.8.0 pyh9f0ad1d_2 conda-forge
pickleshare 0.7.5 py_1003 conda-forge
pillow 8.1.0 py36hc04f27d_1 conda-forge
pip 21.0.1 py36hecd8cb5_0
prometheus_client 0.9.0 pyhd3deb0d_0 conda-forge
prompt_toolkit 1.0.15 py_1 conda-forge
psutil 5.8.0 py36h20b66c6_1 conda-forge
ptyprocess 0.7.0 pyhd3deb0d_0 conda-forge
pycparser 2.20 pyh9f0ad1d_2 conda-forge
pygments 2.8.1 pyhd8ed1ab_0 conda-forge
pyopenssl 20.0.1 pyhd8ed1ab_0 conda-forge
pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge
pyrsistent 0.17.3 py36h20b66c6_2 conda-forge
pysocks 1.7.1 py36h79c6626_3 conda-forge
pytables 3.6.1 py36hce38db3_2 conda-forge
python 3.6.13 h88f2d9e_0
python-dateutil 2.8.1 py_0 conda-forge
python-editor 1.0.4 py_0 conda-forge
python-interface 1.6.0 py_0 conda-forge
python_abi 3.6 1_cp36m conda-forge
pytz 2021.1 pyhd8ed1ab_0 conda-forge
pyyaml 5.4.1 py36h20b66c6_0 conda-forge
pyzmq 20.0.0 py36h23ab428_1
readline 8.1 h9ed2024_0
requests 2.25.1 pyhd3deb0d_0 conda-forge
requests-file 1.5.1 pyh9f0ad1d_0 conda-forge
requests-ftp 0.3.1 py_1 conda-forge
scipy 1.5.1 py36h1dac7e4_0 conda-forge
send2trash 1.5.0 py_0 conda-forge
setuptools 52.0.0 py36hecd8cb5_0
simplegeneric 0.8.1 py_1 conda-forge
six 1.15.0 pyh9f0ad1d_0 conda-forge
sortedcontainers 2.3.0 pyhd8ed1ab_0 conda-forge
sqlalchemy 1.4.3 py36hfa26744_0 conda-forge
sqlite 3.35.2 hce871da_0
statsmodels 0.11.1 py36h37b9a7d_2 conda-forge
tblib 1.7.0 pyhd8ed1ab_0 conda-forge
terminado 0.9.4 py36h79c6626_0 conda-forge
testpath 0.4.4 py_0 conda-forge
tk 8.6.10 hb0a8c7a_0
toolz 0.11.1 py_0 conda-forge
tornado 5.1.1 py36h1de35cc_0
trading-calendars 2.1.1 pyhd3deb0d_0 conda-forge
traitlets 4.3.3 py36h9f0ad1d_1 conda-forge
typing_extensions 3.7.4.3 py_0 conda-forge
urllib3 1.26.4 pyhd8ed1ab_0 conda-forge
wcwidth 0.2.5 pyh9f0ad1d_2 conda-forge
webencodings 0.5.1 py_1 conda-forge
wheel 0.36.2 pyhd3eb1b0_0
xz 5.2.5 h1de35cc_0
yaml 0.2.5 haf1e3a3_0 conda-forge
zeromq 4.3.4 h23ab428_0
zict 2.0.0 py_0 conda-forge
zipline 1.4.1 py36haf1e3a3_0 conda-forge
zipp 3.4.1 pyhd8ed1ab_0 conda-forge
zlib 1.2.11 h1de35cc_3
zstd 1.4.5 h0384e3a_1 conda-forge
想通了。
什么有效:
# 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
完成后,您可以使用 conda 安装其他软件包,如 jupyter、matplotlib 等,这些依赖项对我来说都很好。
为什么:
- Zipline 在本地需要 python 3.6 到 运行,因此需要使用 python 3.6. 设置环境
- 为了在 Jupyter Notebook 中查看环境,我也一直在安装 nb_conda,这可能是问题所在。通过在创建环境时仅安装 ipykernel,然后使用上面的命令行 ipykernel 命令使其在 jupyter notebook 中可见,我就可以避免 nb_conda.