UserWarning: Module “zipline.assets“ not found解决方法
问题描述:执行python程序提示警告无法执行成功,提示警告如下:
pyfolio\pos.py:25: UserWarning: Module "zipline.assets" not found; multipliers will not be applied to position notionals.
使用pip install zipline报错, 报错如下:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting ziplineDownloading https://pypi.tuna.tsinghua.edu.cn/packages/42/9b/5a55c79ca66e1c3ed2d94155cb71eb033eaf96cea71b81eb0579610d489f/zipline-1.4.1.tar.gz (5.4 MB)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.4/5.4 MB 7.3 MB/s eta 0:00:00Preparing metadata (setup.py) ... errorerror: subprocess-exited-with-error× python setup.py egg_info did not run successfully.│ exit code: 1╰─> [26 lines of output]C:\Users\lenovo\AppData\Local\Temp\pip-install-n96fskvq\zipline_4d7d4374b02b491798eb064252b1724f\versioneer.py:587: SyntaxWarning: invalid escape sequence '\s'mo = re.search(r'=\s*"(.*)"', line)Traceback (most recent call last):File "<string>", line 2, in <module>exec(compile('''~~~~^^^^^^^^^^^^# This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...<32 lines>...exec(compile(setup_py_code, filename, "exec"))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^''' % ('C:\\Users\\lenovo\\AppData\\Local\\Temp\\pip-install-n96fskvq\\zipline_4d7d4374b02b491798eb064252b1724f\\setup.py',), "<pip-setuptools-caller>", "exec"))^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "<pip-setuptools-caller>", line 35, in <module>File "C:\Users\lenovo\AppData\Local\Temp\pip-install-n96fskvq\zipline_4d7d4374b02b491798eb064252b1724f\setup.py", line 268, in <module>version=versioneer.get_version(),~~~~~~~~~~~~~~~~~~~~~~^^File "C:\Users\lenovo\AppData\Local\Temp\pip-install-n96fskvq\zipline_4d7d4374b02b491798eb064252b1724f\versioneer.py", line 1405, in get_versionreturn get_versions()["version"]~~~~~~~~~~~~^^File "C:\Users\lenovo\AppData\Local\Temp\pip-install-n96fskvq\zipline_4d7d4374b02b491798eb064252b1724f\versioneer.py", line 1339, in get_versionscfg = get_config_from_root(root)File "C:\Users\lenovo\AppData\Local\Temp\pip-install-n96fskvq\zipline_4d7d4374b02b491798eb064252b1724f\versioneer.py", line 399, in get_config_from_rootparser = configparser.SafeConfigParser()^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata.
╰─> See above for output.note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
问题原因:zipline包的问题,无法安装,类似pyfolio包的安装,报错亦一致,可参考pyfolio包安装错误解决方法-CSDN博客
解决方法:安装zipline-reloaded版,安装命令如下:
# pip安装命令
pip install zipline-reloaded# conda安装命令
conda install -c conda-forge zipline-reloaded
补充说明:假如以上方法安装成功后还会出现其它问题,请安装zipline仓库指定的python版本后重新安装,如python3.6版本