-
-
Notifications
You must be signed in to change notification settings - Fork 848
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
Missing module "init_agent" in run.py #314
Comments
@Yonv1943 Hi! Thanks for maintaining the code. I'd like to know how to use this version of script to run on the notebook FinRL_MultiCrypto_Trading.ipynb in FinRL tutorial repo. |
Same Error here ! Python version : 3.10.12
Does anyone resolve this error ? |
ImportError with Arguments is resolved when According to AI4Finance-Foundation/FinRL#450, that issue can be resolved by downgrading ElegantRL to version before 0.3.3, however other ImportError appear, namely, on ElegantRL 0.3.1, inability to import from elegantrl.agents. Similar work on adapting notebooks to up-to-date version of ElegantRL is currently being made in #325, however, it doesn't seem completely relevant, although I haven't really looked into the changes. However, the problem is not in the ElegantRL getting updates, the issue is in FinRL-meta repo which has not been updated to match new versions of ElegantRL, or notebook not having strict and clear version constrictions which would've enabled us to run the demo. Such issue is also mentioned here AI4Finance-Foundation/FinRL-Meta#291 and here AI4Finance-Foundation/FinRL-Meta#86 Having tried downgrading, and .py script https://github.com/AI4Finance-Foundation/FinRL-Tutorials/blob/master/3-Practical/FinRL_MultiCrypto_Trading.py, and partly rewritten FinRL-Meta/agents/elegantrl_models.py to use Config I still run into the issue Traceback (most recent call last):
File "/home/quakuei/Desktop/docusketch/trading-bot/notebooks/FinRL-Meta/cock.py", line 15, in <module>
from train import train
File "/home/quakuei/Desktop/docusketch/trading-bot/notebooks/FinRL-Meta/train.py", line 1, in <module>
from agents.elegantrl_models import DRLAgent as DRLAgent_erl
File "/home/quakuei/Desktop/docusketch/trading-bot/notebooks/FinRL-Meta/agents/elegantrl_models.py", line 8, in <module>
from elegantrl.train.run import init_agent
ImportError: cannot import name 'init_agent' from 'elegantrl.train.run' (/home/quakuei/Desktop/docusketch/trading-bot/venv/lib/python3.10/site-packages/elegantrl/train/run.py) In overall, I think it would be safe to say that this issue relates more to development of FinRL-Meta repo, rather than ElegantRL. In any case, it drastically worsens reproducibility. In addition, if you try to use other libraries fo RL agents in the same script, you also run into issues, which is not good for the FinRL ease of use. |
@YangletLiu Please help. We are still facing this error. It seems no one managed to resolve it. Kindly update. Anyways, thank you guys for these notebooks. I have been running a few notebooks, faced minor issues but I managed to resolve them and learnt a lot. Keep up the good work |
@Yonv1943 and @zhumingpassional may provide help here! Thanks in advance! |
@YangletLiu @Yonv1943 @zhumingpassional any update about this issue, is it fixed yet |
While testing the FinRL_MultiCrypto_Trading.ipynb notebook, it throws out an error in the following
ImportError Traceback (most recent call last)
in <cell line: 1>()
----> 1 from agents.elegantrl_models import DRLAgent as DRLAgent_erl
2 from agents.rllib_models import DRLAgent as DRLAgent_rllib
3 from agents.stablebaselines3_models import DRLAgent as DRLAgent_sb3
4 from meta.data_processor import DataProcessor
5
/FinRL-Meta/agents/elegantrl_models.py in
6 from elegantrl.agents import AgentTD3
7 from elegantrl.train.config import Config
----> 8 from elegantrl.train.run import init_agent
9 from elegantrl.train.run import train_and_evaluate
10
ImportError: cannot import name 'init_agent' from 'elegantrl.train.run' (/usr/local/lib/python3.10/site-packages/elegantrl/train/run.py)
It looks like the function is removed and it was there in the previous version of run.py. Wondering if which version is proper for the notebook? Is it better to find the recent one which the function still exist to run or editing the notebook?
Many thanks in advance!
The text was updated successfully, but these errors were encountered: