qlib
qlib copied to clipboard
qlib/contrib/data/handler.py:171, in Alpha158.__init__ TypeError: control character 'delimiter' cannot be a newline (`\r` or `\n`).
🐛 Bug Description
qlib/contrib/data/handler.py:171, in Alpha158.init TypeError: control character 'delimiter' cannot be a newline (\r
or \n
).
To Reproduce
Steps to reproduce the behavior:
- runing workflow_by_code.ipynb to train model segment
Expected Behavior
Screenshot
Environment
Package Version
absl-py 0.12.0 alembic 1.7.1 alphalens-reloaded 0.4.2 anyio 3.3.1 arch 5.0.1 argon2-cffi 21.1.0 arviz 0.11.2 asttokens 2.0.5 astunparse 1.6.3 async-timeout 4.0.2 atomicwrites 1.1.5 attrs 21.2.0 Automat 20.2.0 autopep8 1.5.7 Babel 2.9.1 backcall 0.2.0 backtrader 1.9.76.123 bcolz-zipline 1.2.4 beautifulsoup4 4.10.0 bidict 0.22.0 bleach 4.1.0 blinker 1.4 blis 0.7.4 bokeh 2.3.3 Bottleneck 1.3.2 Box2D 2.3.10 box2d-py 2.3.8 cachetools 4.2.2 catalogue 2.0.6 catboost 0.26.1 certifi 2021.5.30 cffi 1.14.6 cftime 1.5.0 chardet 3.0.4 charset-normalizer 2.0.4 click 8.1.3 cloud-init 22.1 cloudpickle 1.6.0 colorama 0.4.3 colorlover 0.3.0 command-not-found 0.3 configobj 5.0.6 constantly 15.1.0 cryptography 3.4.8 cssselect 1.1.0 cvxpy 1.1.15 cycler 0.10.0 cymem 2.0.5 cypari 2.4.1 Cython 0.29.24 cytoolz 0.11.0 databricks-cli 0.17.0 dbus-python 1.2.16 debugpy 1.4.3 decorator 5.1.1 defusedxml 0.7.1 Deprecated 1.2.13 dill 0.3.4 distlib 0.3.4 distro 1.4.0 distro-info 0.23ubuntu1 docker 5.0.3 docopt 0.6.2 ecos 2.0.7.post1 empyrical-reloaded 0.5.8 entrypoints 0.3 et-xmlfile 1.0.1 executing 0.8.3 fastprogress 1.0.0 ffmpeg 1.4 filelock 3.0.12 fire 0.4.0 Flask 2.1.2 flatbuffers 2.0 fonttools 4.33.3 funcy 1.16 future 0.18.2 FXrays 1.3.5 gast 0.3.3 gensim 4.1.0 gitdb 4.0.9 GitPython 3.1.27 google-auth 1.35.0 google-auth-oauthlib 0.4.6 google-pasta 0.2.0 googleapis-common-protos 1.53.0 graphviz 0.17 greenlet 1.1.1 grpcio 1.40.0 gunicorn 20.1.0 gym 0.19.0 gym-notices 0.0.6 h2 3.2.0 h5py 2.10.0 hdbscan 0.8.27 hpack 3.0.0 html5lib 1.1 httplib2 0.14.0 hyperframe 5.2.0 hyperlink 21.0.0 hyperopt 0.1.2 idna 3.2 imageio 2.9.0 importlib-metadata 4.11.3 importlib-resources 5.2.2 incremental 21.3.0 inflection 0.5.1 interval 1.0.0 intervaltree 3.1.0 ipydatawidgets 4.2.0 ipykernel 6.4.1 ipython 7.27.0 ipython-genutils 0.2.0 ipyvolume 0.5.2 ipywebrtc 0.6.0 ipywidgets 7.6.4 iso3166 1.0.1 iso4217 1.6.20180829 itemadapter 0.4.0 itemloaders 1.0.4 itsdangerous 2.1.2 jdcal 1.0 jedi 0.18.0 jellyfish 0.8.8 Jinja2 3.0.1 jmespath 0.10.0 joblib 1.0.1 json5 0.9.6 jsonpatch 1.22 jsonpickle 1.5.2 jsonpointer 2.0 jsonschema 3.2.0 jupyter 1.0.0 jupyter-client 7.0.2 jupyter-console 6.4.0 jupyter-contrib-core 0.3.3 jupyter-contrib-nbextensions 0.5.1 jupyter-core 4.7.1 jupyter-highlight-selected-word 0.2.0 jupyter-latex-envs 1.4.6 jupyter-nbextensions-configurator 0.4.1 jupyter-server 1.11.0 jupyterlab 3.1.11 jupyterlab-server 2.8.1 jupyterlab-widgets 1.0.1 keras 2.8.0 Keras-Preprocessing 1.1.2 keyring 18.0.1 kiwisolver 1.3.2 knot-floer-homology 1.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 libclang 14.0.1 lightgbm 3.3.2 linearmodels 4.24 livelossplot 0.5.4 llvmlite 0.37.0 Logbook 1.5.3 loguru 0.6.0 lru-dict 1.1.7 lxml 4.6.3 Mako 1.1.5 Markdown 3.3.4 MarkupSafe 2.0.1 matplotlib 3.4.3 matplotlib-inline 0.1.3 mistune 0.8.4 mlflow 1.27.0 more-itertools 8.9.0 mplfinance 0.12.7a17 mpmath 1.2.1 multipledispatch 0.6.0 multitasking 0.0.9 munch 2.5.0 murmurhash 1.0.5 mypy-extensions 0.4.3 nbclassic 0.3.1 nbconvert 5.6.1 nbformat 5.1.3 nest-asyncio 1.5.1 netCDF4 1.5.7 netifaces 0.10.4 networkx 2.6.3 nltk 3.6.2 notebook 6.4.3 numba 0.54.0 numexpr 2.7.3 numpy 1.22.3 oauthlib 3.1.1 olefile 0.46 opencv-python 4.5.3.56 openpyxl 3.0.3 opt-einsum 3.3.0 osqp 0.6.2.post0 packaging 21.0 pandas 1.2.5 pandas-datareader 0.10.0 pandocfilters 1.4.3 parsel 1.6.0 parso 0.8.2 pathy 0.6.0 patsy 0.5.1 pexpect 4.8.0 pickleshare 0.7.5 Pillow 8.3.2 pip 22.1.2 platformdirs 2.5.2 plink 2.4 plotly 5.3.1 pluggy 0.13.0 preshed 3.0.5 priority 1.3.0 prometheus-client 0.11.0 prometheus-flask-exporter 0.20.2 promise 2.3 prompt-toolkit 3.0.20 property-cached 1.6.4 Protego 0.1.16 protobuf 3.17.3 psutil 5.9.0 ptyprocess 0.7.0 pure-eval 0.2.2 py 1.8.1 py-cpuinfo 8.0.0 pyarrow 5.0.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycodestyle 2.7.0 pycoingecko 2.2.0 pycparser 2.20 pydantic 1.8.2 PyDispatcher 2.0.5 pydot 1.4.2 pyfolio-reloaded 0.9.4 Pygments 2.10.0 PyGObject 3.36.0 PyHamcrest 1.9.0 pyhdfe 0.1.0 PyJWT 1.7.1 pykalman 0.9.5 pyLDAvis 3.3.1 pymacaroons 0.13.0 pymc3 3.11.4 pymdptoolbox 4.0b3 pymongo 3.7.2 PyNaCl 1.3.0 pynndescent 0.5.4 pyOpenSSL 20.0.1 pyparsing 2.4.7 pyphen 0.11.0 pypng 0.0.21 pyportfolioopt 1.4.2 pyqlib 0.8.6 PyQt5 5.15.4 PyQt5-Qt5 5.15.2 PyQt5-sip 12.9.0 PyQtChart 5.15.4 PyQtChart-Qt5 5.15.2 pyrsistent 0.18.0 pyserial 3.4 pytest 4.6.9 python-apt 2.0.0+ubuntu0.20.4.7 python-dateutil 2.8.2 python-debian 0.1.36ubuntu1 python-engineio 4.3.2 python-interface 1.6.1 python-redis-lock 3.7.0 python-snappy 0.6.1 python-socketio 5.6.0 pythreejs 2.3.0 pytz 2021.1 PyWavelets 1.1.1 PyYAML 5.4.1 pyzmq 22.2.1 qdldl 0.1.5.post0 qtconsole 5.1.1 QtPy 1.11.0 Quandl 3.6.1 querystring-parser 1.2.4 queuelib 1.6.2 redis 4.3.4 regex 2021.8.28 requests 2.26.0 requests-oauthlib 1.3.0 requests-unixsocket 0.2.0 rsa 4.7.2 ruamel.yaml 0.17.21 ruamel.yaml.clib 0.2.6 sacred 0.8.2 schedule 1.1.0 scikit-image 0.18.3 scikit-learn 0.23.2 scipy 1.4.1 Scrapy 2.5.0 scs 2.1.4 seaborn 0.11.2 SecretStorage 2.3.1 semver 2.13.0 Send2Trash 1.8.0 service-identity 21.1.0 setuptools 62.6.0 shap 0.39.0 simplejson 3.16.0 six 1.16.0 sklearn 0.0 slicer 0.0.7 smart-open 5.2.1 smmap 5.0.0 snappy-manifolds 1.1.2 sniffio 1.2.0 sortedcontainers 2.4.0 sos 4.3 soupsieve 2.2.1 spacy 3.1.2 spacy-legacy 3.0.8 spherogram 2.0 SQLAlchemy 1.4.23 sqlparse 0.4.2 srsly 2.4.1 ssh-import-id 5.10 stack-data 0.2.0 statsmodels 0.12.2 stochastic 0.6.0 sympy 1.8 systemd-python 234 TA-Lib 0.4.21 tables 3.6.1 tabulate 0.8.10 tenacity 8.0.1 tensorboard 2.2.2 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 tensorflow 2.2.0 tensorflow-datasets 4.4.0 tensorflow-estimator 2.2.0 tensorflow-io-gcs-filesystem 0.25.0 tensorflow-metadata 1.2.0 tensortrade 1.0.4.dev1 termcolor 1.1.0 terminado 0.12.1 testpath 0.5.0 textacy 0.11.0 textblob 0.15.3 tf-estimator-nightly 2.8.0.dev2021122109 Theano-PyMC 1.1.2 thinc 8.0.10 threadpoolctl 2.2.0 tifffile 2021.8.30 toml 0.10.2 toolz 0.11.1 torch 1.9.0 tornado 6.1 tqdm 4.62.2 trading-calendars 2.1.1 traitlets 4.3.3 traittypes 0.2.1 Twisted 21.7.0 typer 0.4.2 typing-extensions 3.10.0.2 ubuntu-advantage-tools 27.6 ufw 0.36 umap-learn 0.5.1 unattended-upgrades 0.1 urllib3 1.26.6 virtualenv 20.14.1 w3lib 1.22.0 wadllib 1.3.3 wasabi 0.8.2 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 1.2.1 Werkzeug 2.0.1 wheel 0.37.1 widgetsnbextension 3.5.1 wordcloud 1.8.1 wrapt 1.12.1 xarray 0.19.0 xgboost 1.4.2 xlrd 2.0.1 xlwt 1.3.0 yellowbrick 1.2.1 yfinance 0.1.63 zipline-reloaded 2.1.1 zipp 3.5.0 zope.interface 5.4.0
Note: User could run cd scripts && python collect_info.py all
under project directory to get system information
and paste them here directly.
- Qlib version: 0.8.6
- Python version: 3.8.10
- OS (
Windows
,Linux
,MacOS
): Ubuntu - Commit number (optional, please provide it if you are using the dev version):
Additional Notes
For me, by deleting "delimiter="\n"" in "for x in np.loadtxt(fp, str, skiprows=skip_rows, max_rows=n_rows, delimiter="\n", encoding="utf-8")" in file_storage.py is helpful, you can try that!
It is fixed on the latest main branch.
reinstall numpy==1.22.1 works!
I think if we use the latest version in the branch, we don't have to downgrade the numpy version
qlib 0.8.6 still has this problem. then I
pip uninsrtall protobuf pip install protobuf==3.20.0
resolve the problem
I've tried to reinstall the latest version of qlib, but this bug still remained.
I installed qlib with python install pyqlib
today, and the bug is persistent.