AI4Finance-Foundation / FinRL

FinRL: Financial Reinforcement Learning. 🔥
https://ai4finance.org
MIT License
9.39k stars 2.28k forks source link

FinRL sub-modules not found #257

Closed NurbukeTeker closed 2 years ago

NurbukeTeker commented 2 years ago

First of all, we tried the codes in 3 different versions, python version 3.6, 3.7 and 3.8. I installed the FINRL library, which is the unstable development version included in all tutorials (By github library I mean : !pip install git+https://github.com/AI4Finance-LLC/FinRL-Library.git ). But in the packages import part, finrl.config , finrl.marketdata.yahoodownloader etc. I got an error in all import parts.

The fact that the tensorflow version is 1.14.4 said that I should use the python version 3.7 with a research I did. For this reason, I continued on 3.7. But I encountered the same errors in all versions.But I encountered the same errors in all versions.

Similarly, when I download the finrl library as "!pip install finrl", this time finrl.env.EnvMultipleStock_trade etc. I could not access the "finrl.env" modules which are I got the error that there is no such module. I couldn't solve these errors somehow and we decided to play it as the last issue. I would be very happy if you could help with this.

In case of normal pip install env. unable to see files; Likewise, we cannot access most sub modules when installed from GitHub repository.



ModuleNotFoundError Traceback (most recent call last)

in 6 matplotlib.use('Agg') 7 import datetime ----> 8 from finrl.config import config 9 from finrl.marketdata.yahoodownloader import YahooDownloader 10 from finrl.preprocessing.preprocessors import FeatureEngineer ModuleNotFoundError: No module named 'finrl.config' -------------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) in 7 import datetime 8 ----> 9 from finrl.env.environment import EnvSetup 10 from finrl.env.EnvMultipleStock_train import StockEnvTrain 11 from finrl.env.EnvMultipleStock_trade import StockEnvTrade ModuleNotFoundError: No module named 'finrl.env' ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
rayrui312 commented 2 years ago

We have made a round of code refactoring recently. Please check the file train.py or the notebooks.

The following is an example of importing modules in the newest version.

from finrl.apps import config
from finrl.neo_finrl.preprocessor.yahoodownloader import YahooDownloader
from finrl.neo_finrl.preprocessor.preprocessors import FeatureEngineer, data_split
from finrl.neo_finrl.env_stock_trading.env_stocktrading import StockTradingEnv
from finrl.drl_agents.stablebaselines3.models import DRLAgent
from finrl.plot import backtest_stats, backtest_plot, get_daily_return, get_baseline
NurbukeTeker commented 2 years ago

Thanks for fast reply, but I also wonder that "from finrl.env.environment import EnvSetup" line is can meet the same meaning with StockTradingEnv Or which lib I can use for EnvSetup part?

rayrui312 commented 2 years ago

EnvSetup is an old function. It was merged into other parts in the previous updates. We are not using it now. In the newest version, you may check the notebooks for demonstration.