ElegantRL
ElegantRL copied to clipboard
Missing module "init_agent" in run.py
While testing the FinRL_MultiCrypto_Trading.ipynb notebook, it throws out an error in the following
ImportError Traceback (most recent call last)
/FinRL-Meta/agents/elegantrl_models.py in
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!
@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
- ImportError: cannot import name 'Arguments' from 'elegantrl.train.config
- ImportError: cannot import name 'init_agent' from 'elegantrl.train.run'
Does anyone resolve this error ?
Same Error here !
Python version : 3.10.12
- ImportError: cannot import name 'Arguments' from 'elegantrl.train.config
- ImportError: cannot import name 'init_agent' from 'elegantrl.train.run'
Does anyone resolve this error ?
ImportError with Arguments is resolved when Arguments
is changed to Config
as mentioned in #256
According to https://github.com/AI4Finance-Foundation/FinRL/issues/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 https://github.com/AI4Finance-Foundation/FinRL-Meta/issues/291 and here https://github.com/AI4Finance-Foundation/FinRL-Meta/issues/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
@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