Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run cmd python -m qlib.rl.contrib.train_onpolicy --config_path exp_configs/train_opds.yml --run_backtest with error #1764

Open
yanzhengkim opened this issue Mar 19, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@yanzhengkim
Copy link

python -m qlib.rl.contrib.train_onpolicy --config_path exp_configs/train_opds.yml --run_backtest

/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/tianshou/env/venvs.py:66: UserWarning: You provided an environment generator that returned an OpenAI Gym environment. We strongly recommend transitioning to Gymnasium environments. Tianshou is automatically wrapping your environments in a compatibility layer, which could potentially cause issues.
warnings.warn(
Traceback (most recent call last):
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/contrib/train_onpolicy.py", line 268, in
main(config, run_training=not args.no_training, run_backtest=args.run_backtest)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/contrib/train_onpolicy.py", line 241, in main
train_and_test(
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/contrib/train_onpolicy.py", line 159, in train_and_test
train(
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/trainer/api.py", line 63, in train
trainer.fit(vessel)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/trainer/trainer.py", line 224, in fit
self.vessel.train(vector_env)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/trainer/vessel.py", line 171, in train
collector = Collector(self.policy, vector_env, VectorReplayBuffer(self.buffer_size, len(vector_env)))
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/tianshou/data/collector.py", line 80, in init
self.reset(False)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/tianshou/data/collector.py", line 131, in reset
self.reset_env(gym_reset_kwargs)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/tianshou/data/collector.py", line 147, in reset_env
obs, info = self.env.reset(**gym_reset_kwargs)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/utils/finite_env.py", line 233, in reset
for i, o in zip(request_id, super().reset(request_id)):
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/tianshou/env/venvs.py", line 280, in reset
assert (
AssertionError: The environment does not adhere to the Gymnasium's API.
Exception ignored in: <function DataQueue.del at 0x7fc212bf9dc0>
Traceback (most recent call last):
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/utils/data_queue.py", line 148, in del
self.cleanup()
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/site-packages/qlib/rl/utils/data_queue.py", line 101, in cleanup
self._queue.get(block=False)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/multiprocessing/queues.py", line 111, in get
res = self._recv_bytes()
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/multiprocessing/connection.py", line 414, in _recv_bytes
buf = self._recv(4)
File "/hdd9/yanzheng/folder_to_make_space_for_home/miniconda3/envs/py38/lib/python3.8/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError:

@yanzhengkim yanzhengkim added the bug Something isn't working label Mar 19, 2024
@yanzhengkim
Copy link
Author

Does anyone meet the same error? wanna know how to solve this, thanks.

@mrwang1992
Copy link

try use this version package

tianshou==0.4.10
gym==0.26.2
gymnasium==0.29.1

@yanzhengkim
Copy link
Author

try use this version package

tianshou==0.4.10 gym==0.26.2 gymnasium==0.29.1
it worked for me ! thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants