qlib icon indicating copy to clipboard operation
qlib copied to clipboard

NameError: name 'rolling_resi' is not defined

Open ArtificialZeng opened this issue 3 years ago • 3 comments

File ~\AppData\Roaming\Python\Python38\site-packages\qlib\data\data.py:917, in LocalDatasetProvider.dataset(self, instruments, fields, start_time, end_time, freq, inst_processors) 915 start_time = cal[0] 916 end_time = cal[-1] --> 917 data = self.dataset_processor( 918 instruments_d, column_names, start_time, end_time, freq, inst_processors=inst_processors 919 ) 921 return data

File ~\AppData\Roaming\Python\Python38\site-packages\qlib\data\data.py:572, in DatasetProvider.dataset_processor(instruments_d, column_names, start_time, end_time, freq, inst_processors) 562 inst_l.append(inst) 563 task_l.append( 564 delayed(DatasetProvider.inst_calculator)( 565 inst, start_time, end_time, freq, normalize_column_names, spans, C, inst_processors 566 ) 567 ) 569 data = dict( 570 zip( 571 inst_l, --> 572 ParallelExt(n_jobs=workers, backend=C.joblib_backend, maxtasksperchild=C.maxtasksperchild)(task_l), 573 ) 574 ) 576 new_data = dict() 577 for inst in sorted(data.keys()):

File H:\A_software\Anaconda3\envs\py386\lib\site-packages\joblib\parallel.py:1056, in Parallel.call(self, iterable) 1053 self._iterating = False 1055 with self._backend.retrieval_context(): -> 1056 self.retrieve() 1057 # Make sure that we get a last message telling us we are done 1058 elapsed_time = time.time() - self._start_time

File H:\A_software\Anaconda3\envs\py386\lib\site-packages\joblib\parallel.py:935, in Parallel.retrieve(self) 933 try: 934 if getattr(self._backend, 'supports_timeout', False): --> 935 self._output.extend(job.get(timeout=self.timeout)) 936 else: 937 self._output.extend(job.get())

File H:\A_software\Anaconda3\envs\py386\lib\multiprocessing\pool.py:771, in ApplyResult.get(self, timeout) 769 return self._value 770 else: --> 771 raise self._value

NameError: name 'rolling_resi' is not defined

🐛 Bug Description

To Reproduce

Steps to reproduce the behavior:

Expected Behavior

Screenshot

Environment

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:
  • Python version:
  • OS (Windows, Linux, MacOS):
  • Commit number (optional, please provide it if you are using the dev version):

Additional Notes

ArtificialZeng avatar Jul 30 '22 05:07 ArtificialZeng

I'm new to pyqlib and I ran into the same problem yesterday. Could it be that the dataset is causing the problem. When I did the test in workflow_by_code.ipyn, it started reporting these errors again when I mistakenly used the default alpha158, and it worked fine when I changed it to the model's corresponding alpha360.

weibo021 avatar Aug 10 '22 07:08 weibo021

I also encountered the same error.

jingedawang avatar Aug 13 '22 10:08 jingedawang

But I can't reproduce this error. Maybe due to some incomplete installation?

jingedawang avatar Aug 13 '22 12:08 jingedawang

I also met the problem in different machine. I used the same way to reproduce the enviorment that can run qlib smoothly, but the bug still occured. Qlib version: 0.8.6 Python version: 3.8.0 OS (Windows, Linux, MacOS): Linux Commit number (optional, please provide it if you are using the dev version):

Vincent4zzzz avatar Nov 29 '22 08:11 Vincent4zzzz

Also I cannot even locate this variable.

Vincent4zzzz avatar Nov 29 '22 08:11 Vincent4zzzz

the exception cause by the following code in ops.py in my case after debug, which is in python 3.8 and qlib 0.8.6 and windows 10 and vscode.

try: from ._libs.rolling import rolling_slope, rolling_rsquare, rolling_resi from ._libs.expanding import expanding_slope, expanding_rsquare, expanding_resi except ImportError: print( "#### Do not import qlib package in the repository directory in case of importing qlib from . without compiling #####" ) raise except ValueError: print("!!!!!!!! A error occurs when importing operators implemented based on Cython.!!!!!!!!") print("!!!!!!!! They will be disabled. Please Upgrade your numpy to enable them !!!!!!!!") # We catch this error because some platform can't upgrade there package (e.g. Kaggle) # https://www.kaggle.com/general/293387 # https://www.kaggle.com/product-feedback/98562

liningbo avatar Dec 02 '22 00:12 liningbo

the exception cause by the following code in ops.py in my case after debug, which is in python 3.8 and qlib 0.8.6 and windows 10 and vscode.

try: from ._libs.rolling import rolling_slope, rolling_rsquare, rolling_resi from ._libs.expanding import expanding_slope, expanding_rsquare, expanding_resi except ImportError: print( "#### Do not import qlib package in the repository directory in case of importing qlib from . without compiling #####" ) raise except ValueError: print("!!!!!!!! A error occurs when importing operators implemented based on Cython.!!!!!!!!") print("!!!!!!!! They will be disabled. Please Upgrade your numpy to enable them !!!!!!!!") # We catch this error because some platform can't upgrade there package (e.g. Kaggle) # https://www.kaggle.com/general/293387 # https://www.kaggle.com/product-feedback/98562

I solved the problem. I download vs studio 2022 community, and install from source useing 'python setup.py install' . copy the qlib directory in build\lib.win-amd64-3.8 to site-packages. I think it is the rolling.cp38-win_amd64.pyd and expanding.cp38-win_amd64.pyd not suite for my machine ,so i compile them again in my machine, it is ok.

liningbo avatar Dec 04 '22 15:12 liningbo

I solved the problem. I removed my old virtual env and re-create a new virtual env and reinstall pylib by pip install ..

pfcstyle avatar Jan 24 '23 04:01 pfcstyle