qlib icon indicating copy to clipboard operation
qlib copied to clipboard

No module named 'qlib.tests

Open quinnnnnnnnn opened this issue 5 years ago • 8 comments

❓ Questions and Help

(TF2..1) D:\winAI\qlib-main>python scripts/get_data.py qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn Traceback (most recent call last): File "scripts/get_data.py", line 4, in from qlib.tests.data import GetData ModuleNotFoundError: No module named 'qlib.tests' I have already pip install pyqlib, why this happened?

quinnnnnnnnn avatar Dec 12 '20 04:12 quinnnnnnnnn

Yes I get the same error.

AnonymousJY avatar Dec 12 '20 04:12 AnonymousJY

I use conda on linux and had the same error. I created new environment, installed qlib via provided script (python setup.py install), did initialization (from the documentation page) and after was able to run the test script successfully. At some point there was an error on module 'fire' missing, installing this module with conda resolved this error

aleeusgr avatar Dec 12 '20 05:12 aleeusgr

pip will install latest stable qlib. However the main branch of qlib is in active development. If you want to test the latest scripts or functions in main branch. Please install qlib with python setup.py install or python setup.py develop

Thanks

you-n-g avatar Dec 12 '20 06:12 you-n-g

You can try it like this:

  • uninstall pyqlib: python -m pip uninstall pyqlib
  • delete "pyqlib*" and "qlib*" under site-packages
  • reinstall qlib: pip install pyqlib or python setup.py install

zhupr avatar Dec 12 '20 06:12 zhupr

cd source_dir_root touch ./scripts/init.py python -m scripts.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn

it works for me. hope it helps.

attention: qlib.tests package is not included in site-packages after qlib installed.

XuChongBo avatar Dec 12 '20 07:12 XuChongBo

Hi, We've release a new version(0.6.1) of qlib just now. Some recent features in dev version are included.

So you can solve this problem by pip install --upgrade pyqlib or follow the instructions in homepage to install dev version of qlib.

you-n-g avatar Dec 12 '20 10:12 you-n-g

I was able to resolve this by creating new "Conda" virtual environment and installing by pip install pyqlib. One additional library I had to install was pip install nbformat. Thanks.

AnonymousJY avatar Dec 12 '20 19:12 AnonymousJY

This worked for me. git clone https://github.com/microsoft/qlib.git && cd qlib pip install .

uredkar avatar Feb 21 '21 19:02 uredkar